Skip to content

KAFKA-19305 Ensure all image classes are immutable #19847

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

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

Conversation

jim0987795064
Copy link

This pull request addresses KAFKA-19305 by ensuring that collections used in these classes are fully immutable.

Changes

  • Updated ClientQuotaImage and TopicImage by using Collections.unmodifiableMap or ImmutableMap to prevent accidental or intentional mutations after construction.

@github-actions github-actions bot added triage PRs from the community kraft small Small PRs labels May 29, 2025
@jim0987795064 jim0987795064 changed the title (WIP)KAFKA-19305 Ensure all image classes are immutable KAFKA-19305 Ensure all image classes are immutable May 29, 2025
@@ -45,7 +45,7 @@ public final class ClientQuotaImage {
private final Map<String, Double> quotas;

public ClientQuotaImage(Map<String, Double> quotas) {
this.quotas = quotas;
this.quotas = Collections.unmodifiableMap(quotas);
Copy link
Member

Choose a reason for hiding this comment

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

the method quotaMap doesn't need to call Collections.unmodifiableMap, right?

@github-actions github-actions bot removed the triage PRs from the community label May 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants