Repository navigation
require Java 17 and use pattern-matching instanceof in src/main - #126
Merged
Merged
Conversation
Raise the source/target level to Java 17 (Gradle and Ant builds) and convert check-then-cast instanceof idioms in src/main to Java 17 pattern matching. The forbiddenApis block's targetCompatibility line was resolving to the project property and pinning the whole build to 14, so it is removed; forbiddenApis now follows the project target. Only language features are used; no new JDK APIs, so the Android API 26 animalsniffer check still passes. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
Moves the baseline from Java 8 to Java 17 and adopts Java 17 language idioms in
src/main.Build
build.gradle: source/target 17, defaultjdkVersion17;compileJava9(module-info) also compiles at 17, since a release-9 compile cannot read Java 17 class files; javadoc uses source 17 and links the Java 17 API docs.targetCompatibility = ...14from theforbiddenApis { }block. It was resolving to the project property and pinning every compile to target 14, which fails with source 17. forbiddenApis now follows the project target.build.xml:releaseandjdk.version.*set to 17.xkit/README.txt: minimum JDK is now 17.Code
instanceofsites converted to pattern matching (instanceof Foo foo), mostly via OpenRewrite'sInstanceOfPatternMatch, then hand-tidied (binding names, leftover blank lines). Two sites kept their casts where a binding read worse (CharUtilreusingj,Localeassigningcharson both branches).var, records or switch-statement rewrites in this PR.Verification
./gradlew check javadoc jar -x ratpasses locally on JDK 17 (3194 tests, 0 failures).ratwas skipped only because of untracked local IDE directories.🤖 Generated with Claude Code