cloudevents / cloudevents/sdk-java

BaseCloudEvent.getExtensionNames() breaks cloud event encapsulation

Open
#581 2 comments 0 reactions 1 assignee View on GitHub

@mhaider97 is already working on this.

Since Oct 2, 2023.

enhancement help wanted
Dominant language
Java
Stars
446
Forks
172
PR merge metrics
No merged PRs in 30d

Description

please replace

@Override
public Set<String> getExtensionNames() {
    return this.extensions.keySet();
}

with something, like

@Override
public Set<String> getExtensionNames() {
    return Collections.unmodifiableSet (this.extensions.keySet());
}

to avoid breaking encapsulation.

More details can be found here

https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html#keySet--
Returns a Set view of the keys contained in this map. The set is backed by the map, so changes to the map are reflected in the set, and vice-versa.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.