cloudevents / cloudevents/sdk-java
BaseCloudEvent.getExtensionNames() breaks cloud event encapsulation
Open
@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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.