Repository navigation
Only run tests for Thread methods removed from newer JDKs on Java 21 and below - #1298
Merged
Merged
Conversation
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.
Problem
Running the full test suite on JDK 25 fails four tests. Each one exercises a
Threadmethod that was removed from the JDK after Java 21:ThreadStopUnsupportedTest#replaceResumeWithThrowsOnJava21(Thread.resume())ThreadStopUnsupportedTest#replaceSuspendWithThrowsOnJava21(Thread.suspend())DeprecatedCountStackFramesMethodTest, both tests (Thread.countStackFrames())The parser takes JDK types from the JVM running it, so on JDK 25 these invocations have no method type. Type validation then fails, and the recipes'
MethodMatchers don't match.Changes
Limit these tests to Java 21 and below with
@EnabledForJreRange(max = JAVA_21). CI keeps running them, since the build job tests on 21.This is the last change needed for the whole suite to pass on 25, after #1297 and 353d346 (
OptionalStreamRecipe). With it, a full run on JDK 25 gives 2198 tests and 0 failures, using the init script from openrewrite/gh-automation#120. Once that PR is merged, we can addadditional_test_java_versions: '[25]'toci.ymlto run the tests on 25 in CI as well.Follow-up
These tests now pass, but the recipes still silently make no changes when run on JDK 25, for example from a CLI running on 25. The same applies on 21+ to
DeleteDeprecatedFinalize, whose test has been limited to Java 17 since we moved to the 21 toolchain. A real fix would match on the method name and receiver type when the method type is missing.