-
Notifications
You must be signed in to change notification settings - Fork 40
Remove deprecated API usages (Part 1) #2947
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary of Changes
Hello @brfrn169, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request focuses on a large-scale refactoring effort to eliminate deprecated API usages throughout the codebase. The changes involve updating various constructor calls and helper methods to align with modern API design patterns, particularly for key and condition handling. This initiative aims to improve code maintainability, readability, and ensure compatibility with future library versions.
Highlights
- Modernization of API Constructors: The pull request systematically replaces deprecated constructors for
Key,ConditionalExpression, andScan.Orderingwith their modern, recommended static factory methods. This improves code readability and adherence to current API standards. - Migration to ConditionBuilder Utilities: Deprecated condition builder constructors like
PutIf,DeleteIf,PutIfExists, andPutIfNotExistsare updated to use theConditionBuilderutility class, centralizing condition creation and enhancing type safety. - Refactoring of Attribute Class Usage: The
Attributeclass, which defines transaction-related column names, has been refactored to remove deprecated helper methods that converted raw types toValueobjects. Direct column creation or specificwithValuemethods are now used, simplifying attribute handling. - Comprehensive Test Suite Updates: A significant portion of the changes involves updating existing test cases across various storage implementations (Cassandra, Cosmos, Dynamo, JDBC) and transaction components to reflect the new API usages, ensuring continued correctness and compatibility.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request does a great job of removing deprecated API usages throughout the codebase, which is an important maintenance task. The changes are largely correct and improve the code's modernity. I've found a few potential issues in the test files, likely introduced by the automated code generation tool, where some method arguments seem to have been changed incorrectly. Please see my detailed comments for specifics.
core/src/test/java/com/scalar/db/transaction/consensuscommit/SnapshotTest.java
Outdated
Show resolved
Hide resolved
core/src/test/java/com/scalar/db/transaction/consensuscommit/SnapshotTest.java
Outdated
Show resolved
Hide resolved
core/src/test/java/com/scalar/db/transaction/consensuscommit/SnapshotTest.java
Outdated
Show resolved
Hide resolved
core/src/test/java/com/scalar/db/transaction/consensuscommit/SnapshotTest.java
Outdated
Show resolved
Hide resolved
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR removes deprecated API usages from the codebase, primarily focusing on modernizing Key constructors, ConditionalExpression usage, and Attribute helper methods. The changes improve code maintainability by eliminating legacy APIs and adopting recommended patterns.
- Replaced deprecated
Keyconstructors with modern static factory methods (Key.ofInt,Key.ofText,Key.of) - Updated deprecated
Attribute.to*Value()methods to use direct column construction and value assignment - Modernized conditional expression construction using
ConditionBuilderinstead of deprecated constructors
Reviewed Changes
Copilot reviewed 61 out of 61 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| TwoPhaseConsensusCommitSpecificIntegrationTestBase.java | Updated Key constructors and Attribute methods to non-deprecated equivalents |
| ConsensusCommitSpecificIntegrationTestBase.java | Replaced deprecated Key constructors with static factory methods |
| TwoPhaseCommitTransactionIntegrationTestBase.java | Modernized Key construction patterns |
| DistributedTransactionIntegrationTestBase.java | Updated Key constructors throughout test methods |
| DistributedTransactionAdminIntegrationTestBase.java | Replaced deprecated Key constructor usage |
| DistributedStoragePermissionIntegrationTestBase.java | Updated conditional expression construction using ConditionBuilder |
| DistributedStorageIntegrationTestBase.java | Modernized condition builders and Key constructors |
| DistributedStorageAdminIntegrationTestBase.java | Updated Key constructor usage |
| JdbcTransactionManagerTest.java | Replaced deprecated Key constructors with factory methods |
| Multiple consensus commit test files | Updated Attribute helper methods and Key constructors |
| Multiple storage test files | Modernized Key construction and conditional expressions |
|
/gemini review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request does a great job of removing deprecated API usages throughout the codebase, replacing them with modern, builder-style alternatives. The changes are extensive and well-executed. I've found a few minor issues in the test files where the refactoring might have unintentionally altered the test logic. Please see my detailed comments.
core/src/test/java/com/scalar/db/common/checker/OperationCheckerTest.java
Outdated
Show resolved
Hide resolved
core/src/test/java/com/scalar/db/storage/cosmos/SelectStatementHandlerTest.java
Outdated
Show resolved
Hide resolved
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
|
/gemini review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request effectively removes a significant number of deprecated API usages across the codebase. The changes primarily involve replacing deprecated constructors for Key, ConditionalExpression, Scan.Ordering, and various condition classes with their modern static factory methods or builders. The refactoring has been applied consistently and correctly throughout the production and test code. The removal of helper methods from Attribute.java and updating the call sites is also a good cleanup. Overall, these changes improve the code's adherence to the current API and enhance maintainability. The pull request looks good to merge.
komamitsu
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you!
feeblefakie
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thank you!
Torch3333
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you!
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Co-authored-by: Copilot <[email protected]>
Description
This PR removes deprecated API usages. The changes were primarily made using Claude Code.
Related issues and/or PRs
N/A
Changes made
Attribute.Keyconstructors usages.ConditionalExpressionconstructors usages.Scan.Orderingconstructor usages.ConditionalExpression.Checklist
Additional notes (optional)
N/A
Release notes
N/A