Skip to content

Add FindVirtualThreadOpportunities#2684

Closed
Pankraz76 wants to merge 1 commit into
diffplug:mainfrom
Pankraz76:pr-StringRulesRecipes
Closed

Add FindVirtualThreadOpportunities#2684
Pankraz76 wants to merge 1 commit into
diffplug:mainfrom
Pankraz76:pr-StringRulesRecipes

Conversation

@Pankraz76
Copy link
Copy Markdown

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
private void parallelRun(ThrowableRun runnable) {
IntStream.range(0, 5)
.mapToObj(i -> new Thread(() -> {
.mapToObj(i -> /*~~>*/new Thread(() -> {
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

does this really make any difference?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yup, we just upgraded our baseline to 17, it will be a while before our baseline is 21+

@nedtwigg nedtwigg closed this Oct 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants