Darrel Schneider created GEODE-9450:
---------------------------------------

             Summary: StringBytesGlossary has a large number of MakeImmutable 
annotations
                 Key: GEODE-9450
                 URL: https://issues.apache.org/jira/browse/GEODE-9450
             Project: Geode
          Issue Type: Improvement
          Components: redis
            Reporter: Darrel Schneider


All of the byte array constants in StringBytesGlossary are annotated with 
MakeImmutable. This annotation indicates that changes need to be made.

We could just change the annotation to Immutable but then we would still have 
static fields that could actually be mutated.

In the case of StringBytesGlossary it seems like some of the byte array 
constants in it could be encapsulated into an Enum constant. The Enum 
constructor would take a byte array and store it the instance. But it would not 
have methods that allow other classes to get a reference to the byte array. 
Instead it could just have a "boolean equalsIgnoreCaseBytes(byte[])" and any 
other comparison methods needed and only those methods would need to be coded 
correctly to not modify the array. This would work fine for all the redis 
keywords we need to identify. Instead of passing a byte array to the 
constructor we could probably just use Enum.getName() in the constructor and 
call stringToBytes on it.

But other constants in StringBytesGlossary are used for output to be sent back 
the the client (for example see bPING_RESPONSE). For those we probably should 
just mark the as Immutable.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to