-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
[java] Replacing some deprecated methods #15443
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
base: trunk
Are you sure you want to change the base?
Conversation
In several locations I've removed some minor deprecated code and used the the recommended replacements.
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
@@ -95,7 +95,7 @@ public synchronized String format(final LogRecord record) { | |||
return buffer.toString(); | |||
} | |||
|
|||
private String levelNumberToCommonsLevelName(Level level) { | |||
private static String levelNumberToCommonsLevelName(Level level) { |
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.
Why is this changed?
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.
Oh, that wasn't intentional. Sorry, I'll remove and resubmit.
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.
Thank you
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.
Thank you @zodac! LGTM
User description
Motivation and Context
There were several places where some deprecated method calls were being used (some for internal project code, others for libraries). Where possible and obvious, I've replaced this code with the non-deprecated methods.
Types of changes
Checklist
bazel test //java/... --test_size_filters=small
)PR Type
Enhancement, Bug fix, Tests
Description
Replaced deprecated
newInstance
withgetDeclaredConstructor().newInstance
for reflection-based object creation.Updated
SlowLoadableComponent
constructors to useDuration.ofSeconds
for timeout values.Migrated from
MockitoAnnotations.initMocks
toMockitoAnnotations.openMocks
in test setup methods.Improved type safety in assertions using
InstanceOfAssertFactories
in tests.Changes walkthrough 📝
7 files
Replace deprecated
newInstance
withgetDeclaredConstructor().newInstance
Update GraphQL coercing methods to include additional parameters
Make `levelNumberToCommonsLevelName` method static
Replace deprecated
newInstance
withgetDeclaredConstructor().newInstance
Replace deprecated
newInstance
withgetDeclaredConstructor().newInstance
Use `Duration.ofSeconds` for timeout in `SlowLoadableComponent`
Use `Duration.ofSeconds` for timeout in `SlowLoadableComponent`
6 files
Replace `initMocks` with `openMocks` in test setup
Replace `initMocks` with `openMocks` in test setup
Replace `initMocks` with `openMocks` in test setup
Replace `initMocks` with `openMocks` in test setup
Replace `initMocks` with `openMocks` in test setup
Improve type safety in assertions using `InstanceOfAssertFactories`