Skip to content

Upgrade OpenRewrite 3.14.0 -> 3.16.0#1853

Merged
rickie merged 4 commits intomasterfrom
renovate/openrewrite-3.x
Oct 13, 2025
Merged

Upgrade OpenRewrite 3.14.0 -> 3.16.0#1853
rickie merged 4 commits intomasterfrom
renovate/openrewrite-3.x

Conversation

@Picnic-DevPla-Bot
Copy link
Copy Markdown
Contributor

This PR contains the following updates:

Package Type Update Change
OpenRewrite import patch 3.14.0 -> 3.14.1

Release Notes

openrewrite/rewrite-recipe-bom (OpenRewrite)

v3.14.1: 3.14.1

Compare Source

What's Changed

  • Incorporates the latest versions of OpenRewrite (v8.62.0), the rewrite-gradle-plugin (v7.16.0), and the rewrite-maven-plugin (v6.18.0) to improve code parsing accuracy and recipe execution reliability.

Full Changelog: https://github.com/openrewrite/rewrite-recipe-bom


  • If you want to rebase/retry this PR, check this box

Copy link
Copy Markdown
Member

@Stephan202 Stephan202 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The build now fails with JDK 23 and 24, due to the following error:

Caused by: java.lang.NoSuchMethodError: 'com.sun.tools.javac.tree.DCTree$DCDocComment com.sun.tools.javac.tree.DocCommentTable.getCommentTree(com.sun.tools.javac.tree.JCTree)'
	at org.openrewrite.java.isolated.ReloadableJava21ParserVisitor.convert(ReloadableJava21ParserVisitor.java:1839)
	... 87 more

@timtebeek with JDK 25 around the corner, I'm not sure you're interested in fixing this ^.

I did just now try to build with JDK 25.ea.36-open and org.openrewrite:rewrite-java-25, but then org.openrewrite:rewrite-templating causes Java to report warnings for which a suppression is in place; it appears that OpenRewrite somehow messes with the compiler diagnostics. 🤔 (I can file an upstream issue for this if you want; it would prevent us from adopting JDK 25.)

@timtebeek
Copy link
Copy Markdown
Contributor

hi! We did indeed make a deliberate change in how we select the Java parser to use, and which features to support in each parser. That's described here as well

We'd be interested to hear what warnings would prevent you from upgrading, and if that's something we can fix with a patch release we're happy to do so.

@Stephan202
Copy link
Copy Markdown
Member

Check! I'll get back to you on the deprecation warnings.

@Stephan202 Stephan202 force-pushed the renovate/openrewrite-3.x branch from ce0f9ea to 3b6b58e Compare September 18, 2025 17:34
@github-actions
Copy link
Copy Markdown

Looks good. No mutations were possible for these changes.
Mutation testing report by Pitest. Review any surviving mutants by inspecting the line comments under Files changed.

Copy link
Copy Markdown
Member

@Stephan202 Stephan202 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I rebased and added a commit to include rewrite-java-25.

So when building with JDK 25, mvn clean compile -pl error-prone-contrib now breaks due to the following warnings (as we build with -Werror):

[WARNING] /tmp/error-prone-support/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssertJRules.java:[175,35] unchecked generic array creation for varargs parameter of type S[] 
[WARNING] /tmp/error-prone-support/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssertJRules.java:[176,38] unchecked generic array creation for varargs parameter of type S[] 
[WARNING] /tmp/error-prone-support/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssertJRules.java:[177,41] unchecked generic array creation for varargs parameter of type S[] 
[WARNING] /tmp/error-prone-support/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssertJRules.java:[183,33] unchecked generic array creation for varargs parameter of type S[] 
[WARNING] /tmp/error-prone-support/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssertJRules.java:[191,47] unchecked generic array creation for varargs parameter of type S[] 
[WARNING] /tmp/error-prone-support/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssertJRules.java:[197,39] unchecked generic array creation for varargs parameter of type S[] 
[WARNING] /tmp/error-prone-support/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssertJRules.java:[206,50] unchecked generic array creation for varargs parameter of type S[] 
[WARNING] /tmp/error-prone-support/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssertJThrowingCallableRules.java:[769,29] hasCauseReference(java.lang.Throwable) in org.assertj.core.api.AbstractThrowableAssert has been deprecated
[WARNING] /tmp/error-prone-support/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/ImmutableEnumSetRules.java:[93,35] unchecked generic array creation for varargs parameter of type T[] 
[WARNING] /tmp/error-prone-support/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/ImmutableEnumSetRules.java:[115,35] unchecked generic array creation for varargs parameter of type T[] 
[WARNING] /tmp/error-prone-support/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/ImmutableEnumSetRules.java:[138,35] unchecked generic array creation for varargs parameter of type T[]
[WARNING] /tmp/error-prone-support/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/ImmutableEnumSetRules.java:[161,35] unchecked generic array creation for varargs parameter of type T[] 
[WARNING] /tmp/error-prone-support/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/ImmutableEnumSetRules.java:[184,35] unchecked generic array creation for varargs parameter of type T[]
[WARNING] /tmp/error-prone-support/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/ImmutableEnumSetRules.java:[205,35] unchecked generic array creation for varargs parameter of type T[] 
[WARNING] /tmp/error-prone-support/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/MockitoRules.java:[73,85] unchecked cast
  required: T 
  found:    java.lang.Object
[WARNING] /tmp/error-prone-support/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/ReactorRules.java:[2079,26] unchecked generic array creation for varargs parameter of type T[] 

The warnings don't occur (correctly, as they're suppressed) when I disable the annotation processor:

diff --git a/pom.xml b/pom.xml
index aa5b1114..72834b7f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -962,10 +962,6 @@
                                 <groupId>com.google.auto.service</groupId>
                                 <artifactId>auto-service</artifactId>
                             </path>
-                            <path>
-                                <groupId>org.openrewrite</groupId>
-                                <artifactId>rewrite-templating</artifactId>
-                            </path>
                         </annotationProcessorPaths>
                         <compilerArgs>
                             <arg>--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED</arg>

(@timtebeek I'll file an issue upstream in your issue tracker, referencing this comment.)

@Stephan202
Copy link
Copy Markdown
Member

Stephan202 commented Sep 18, 2025

Suggested commit message:

Upgrade OpenRewrite 3.14.0 -> 3.16.0 (#1853)

See:
- https://github.com/openrewrite/rewrite-recipe-bom/releases/tag/v3.14.1
- https://github.com/openrewrite/rewrite-recipe-bom/releases/tag/v3.15.0
- https://github.com/openrewrite/rewrite-recipe-bom/releases/tag/v3.16.0
- https://github.com/openrewrite/rewrite-recipe-bom/compare/v3.14.0...v3.16.0

@Stephan202
Copy link
Copy Markdown
Member

I filed openrewrite/rewrite-templating#165.

@Picnic-DevPla-Bot
Copy link
Copy Markdown
Contributor Author

Edited/Blocked Notification

Renovate will not automatically rebase this PR, because it does not recognize the last commit author and assumes somebody else may have edited the PR.

You can manually request rebase by checking the rebase/retry box above.

⚠️ Warning: custom changes will be lost.

@Stephan202
Copy link
Copy Markdown
Member

I filed openrewrite/rewrite-templating#165.

Update for watchers of this PR: the issue is triggered by a change in JDK 25 that is already fixed for JDK 26. Let's see whether we can get the fix backported. Details in the linked issue.

@timtebeek
Copy link
Copy Markdown
Contributor

From the comments on openjdk/jdk#24584 (comment) it doesn't seem like there's a lot of excitement around a back port of the fix in 26 to 25. Would it be possible to instead loosen the validation options specifically only for the compile-recipes execution?

error-prone-support/pom.xml

Lines 995 to 1015 in 6aec53d

<!-- OpenRewrite recipe sources, generated by the
`rewrite-templating` annotation processor and
identified as classes whose name ends in `Recipes`, are
compiled to target Java 8 for compatibility with the
wider OpenRewrite ecosystem. The `maven-jar-plugin` is
configured to package these files into a separate JAR. -->
<execution>
<id>compile-recipes</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<compilerArgs combine.self="override">
<!-- When Java 8 is targeted we can't use
the `add-exports` flag. And since this goal
only recompiles already-compiled code,
static analysis is irrelevant. As such we
clear all compiler arguments, and only
suppress source/target/bootstrap classpath
warnings. -->
<arg>-Xlint:-options</arg>

That way we could get this change in and the annotation processor option I want to add once this has been merged:
https://github.com/openrewrite/rewrite-templating?tab=readme-ov-file#use-javaparserbuilder-classpathfromresourcesctx-guava-31

By default, the annotation processor will use JavaParser.runtimeClasspath() to resolve the classpath for newly generated Java code snippets. If you want to use TypeTables from src/main/resources/META-INF/rewrite/classpath.tsv.gz instead, pass in the following option:

-Arewrite.javaParserClasspathFrom=resources

@Stephan202 Stephan202 force-pushed the renovate/openrewrite-3.x branch from 3b6b58e to 3d4e665 Compare October 12, 2025 20:16
@Stephan202 Stephan202 changed the title Upgrade OpenRewrite 3.14.0 -> 3.14.1 Upgrade OpenRewrite 3.14.0 -> 3.16.0 Oct 12, 2025
@Stephan202 Stephan202 added this to the 0.26.0 milestone Oct 12, 2025
@github-actions
Copy link
Copy Markdown

Looks good. No mutations were possible for these changes.
Mutation testing report by Pitest. Review any surviving mutants by inspecting the line comments under Files changed.

@Stephan202
Copy link
Copy Markdown
Member

@timtebeek sorry for the radio silence here; it's been very busy. Working around it proved to be more involved, but I think I managed 🎉. I rebased and added two commits.

(Not sure whether the Reviewdog build failure comes from all of a sudden, but hopefully that goes away after #1915.)

Copy link
Copy Markdown
Member

@Stephan202 Stephan202 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optimistically approving :)

@rickie rickie force-pushed the renovate/openrewrite-3.x branch from 3d4e665 to 0f3f390 Compare October 13, 2025 07:11
@github-actions
Copy link
Copy Markdown

Looks good. No mutations were possible for these changes.
Mutation testing report by Pitest. Review any surviving mutants by inspecting the line comments under Files changed.

@sonarqubecloud
Copy link
Copy Markdown

@rickie rickie merged commit 7607d1b into master Oct 13, 2025
18 checks passed
@rickie rickie deleted the renovate/openrewrite-3.x branch October 13, 2025 07:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

4 participants