apache / apache/accumulo

MetadataSchema convenience Text methods for constants does not enforce strict immutability

Open
#3,865 1 comment 0 reactions 1 assignee Claimed by @ctubbsii View on GitHub
enhancement
Dominant language
Java
Stars
1.2k
Forks
487
Avg merge
4d 5h
Merged PRs (30d)
13

Description

The convenience definitions that provide a `Text` object for constants in MetadataSchema expose the constants to changes if the Text object is mutated. For example:

```
public static class ServerColumnFamily {
public static final String STR_NAME = "srv";
public static final Text NAME = new Text(STR_NAME);
...
```

Anything that uses `ServerColumnFamily.NAME` and then writes to that object will change the definition for everything using that `ServerColumnFamily.NAME` object,

Options:

- If it is not a significant impact, could those convenience definitions of Text objects be removed?
- Subclass the Text object in these cases to enforce immutability?
- Use a immutable "byte-array" class instead of Text?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.