Skip to content

Set Java version marker directly in tests using allSources - #1344

Merged
timtebeek merged 1 commit into
mainfrom
tim/use-javaversion-marker-in-tests
Oct 24, 2026
Merged

timtebeek merged 1 commit into
mainfrom
tim/use-javaversion-marker-in-tests

Conversation

@timtebeek

@timtebeek timtebeek commented Oct 24, 2026 •

Copy link
Copy Markdown
Member

org.openrewrite.java.Assertions is now annotated @CheckReturnValue, so FindIgnoredCheckReturnValue from rewrite-static-analysis flags every allSources(source -> version(source, N)): the Consumer lambda discards the returned SourceSpec. The calls work anyway, because version mutates the spec in place, but the warnings are noise. This switches the 10 occurrences across 8 test classes to s -> s.markers(javaVersion(N)) and drops the version import where it is no longer used.

Same change as openrewrite/rewrite-static-analysis#1114 for InstanceOfPatternMatchTest.

Verified by running the 8 affected test classes with ./gradlew test --tests ...: 166 tests, all passing.

@github-project-automation github-project-automation Bot moved this to In Progress in OpenRewrite Oct 24, 2026
@timtebeek
timtebeek merged commit 6afa33e into main Oct 24, 2026
2 checks passed
@timtebeek
timtebeek deleted the tim/use-javaversion-marker-in-tests branch October 24, 2026 15:23
@github-project-automation github-project-automation Bot moved this from In Progress to Done in OpenRewrite Oct 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

1 participant