justinmclean opened a new issue, #7957:
URL: https://github.com/apache/gravitino/issues/7957

   ### What would you like to be improved?
   
   The namespace constructor accepts an array, but that array could be modified 
after the namespace has been created, changing the namespace.
   
   levels() also give access to that array, allowing it to be modified, which 
is probably not its intention.
   
   You can add this test to show this:
   ```
     @Test
     public void testNamespaceImmutability() {
       String[] levels = new String[] {"a", "b"};
       Namespace ns = Namespace.of(levels);
   
       // Modifying the original array should not affect the namespace
       levels[0] = "x";
       Assertions.assertEquals("a", ns.level(0));
   
       // Modifications to the returned levels array should also not affect the 
namespace
       String[] returnedLevels = ns.levels();
       returnedLevels[1] = "y";
       Assertions.assertEquals("b", ns.level(1));
     }
   ```
   
   ### How should we improve?
   
   Make sure this dosn't occur


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to