Skip to content
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

MINOR: Cleanup Core Module- Scala Modules (1/n) #19380

Open
wants to merge 5 commits into
base: trunk
Choose a base branch
from

Conversation

sjhajharia
Copy link
Contributor

@sjhajharia sjhajharia commented Apr 5, 2025

Now that Kafka Brokers support Java 17, this PR makes some changes in
core module. The changes in this PR are limited to only the Scala files
in the Core module's tests. The unit tests module is still pending. It
shall follow next. The changes mostly include:

  • Collections.emptyList(), Collections.singletonList() and
    Arrays.asList() are replaced with List.of()
  • Collections.emptyMap() and Collections.singletonMap() are replaced
    with Map.of()
  • Collections.singleton() is replaced with Set.of()

To be clear, the directories being targeted in this PR are:

  • core/src/test/scala/kafka
  • core/src/test/scala/integration/kafka

@github-actions github-actions bot added triage PRs from the community core Kafka Broker tests Test fixes (including flaky tests) labels Apr 5, 2025
@sjhajharia
Copy link
Contributor Author

OffloadAndTxnConsumeFromLeaderTest -> Seems to be a flaky test

Copy link
Collaborator

@m1a2st m1a2st left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @sjhajharia, Thanks for this PR. I found there are some Collections related not modified on your branch. Could you take a look.
CleanShot 2025-04-07 at 23 40 17@2x

@sjhajharia sjhajharia changed the title [MINOR] Cleanup Core Module- Scala Modules [MINOR] Cleanup Core Module- Scala Modules (1/n) Apr 7, 2025
@sjhajharia
Copy link
Contributor Author

Hey @m1a2st
Thanks for the checks. Yes you are correct, this PR doesnt handle all the Scala files at once. (I tried to take a rough estimate and it was way over 125 files).
This is the first PR in the series and this targets just the code in the integration tests folder. This shall be followed by changes in the unit tests folder and then finally the main code folder.
Let me update the PR title to 1/n

@sjhajharia sjhajharia changed the title [MINOR] Cleanup Core Module- Scala Modules (1/n) MINOR: Cleanup Core Module- Scala Modules (1/n) Apr 7, 2025
@github-actions github-actions bot removed the triage PRs from the community label Apr 8, 2025
Copy link
Collaborator

@m1a2st m1a2st left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @sjhajharia for this patch, left some comments.

Could you check all scala code which use asJava to transfer Scala collection to Java collection, We can avoid to use both collection in same file.
And also update util.Arrays.asList to java.util.List.of.

@sjhajharia
Copy link
Contributor Author

Thanks @m1a2st for the comment.
I had eliminated all the asList cases. The conversions to asJava was a good bird to target as well. Thanks for the suggestion. I have updated the PR accordingly (and have thus added many more files).

To be clear, the directories being targeted in this PR are:

  • core/src/test/scala/kafka
  • core/src/test/scala/integration/kafka

@sjhajharia sjhajharia requested a review from m1a2st April 8, 2025 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci-approved core Kafka Broker tests Test fixes (including flaky tests)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants