Add FindVirtualThreadOpportunities#2684
Closed
Pankraz76 wants to merge 1 commit into
Closed
Conversation
Pankraz76
commented
Oct 15, 2025
- https://docs.openrewrite.org/recipes/java/migrate/lang/findvirtualthreadopportunities
All sources parsed, running active recipes: com.diffplug.spotless.openrewrite.SanityCheck, com.diffplug.spotless.openrewrite.SanityCheck, com.diffplug.spotless.openrewrite.SanityCheck, com.diffplug.spotless.openrewrite.SanityCheck, com.diffplug.spotless.openrewrite.SanityCheck, com.diffplug.spotless.openrewrite.SanityCheck
Changes have been made to lib/src/main/java/com/diffplug/spotless/ProcessRunner.java by:
com.diffplug.spotless.openrewrite.SanityCheck
org.openrewrite.java.migrate.lang.FindVirtualThreadOpportunities
org.openrewrite.java.migrate.lang.FindNonVirtualExecutors
org.openrewrite.java.search.FindMethods: {methodPattern=java.util.concurrent.Executors#newSingleThreadExecutor(..)}
Changes have been made to testlib/src/test/java/com/diffplug/spotless/GitPrePushHookInstallerTest.java by:
com.diffplug.spotless.openrewrite.SanityCheck
org.openrewrite.java.migrate.lang.FindVirtualThreadOpportunities
org.openrewrite.java.search.FindMethods: {methodPattern=java.lang.Thread#<constructor>(..)}
Please review and commit the results.
Estimate time saved: 10m
Pankraz76
commented
Oct 15, 2025
| private void parallelRun(ThrowableRun runnable) { | ||
| IntStream.range(0, 5) | ||
| .mapToObj(i -> new Thread(() -> { | ||
| .mapToObj(i -> /*~~>*/new Thread(() -> { |
Author
There was a problem hiding this comment.
does this really make any difference?
Member
There was a problem hiding this comment.
No, I don't think so.
I wonder if all that FindVirtualThreadOpportunities does is literally point out potential opportunities to adopt virtual threads, not actually migrate them.
Furthermore, I wonder if we still need to support versions of Java that don't have virtual threads.
Therefore, I'm inclined to remove this rule.
Member
There was a problem hiding this comment.
Yup, we just upgraded our baseline to 17, it will be a while before our baseline is 21+
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.