ctubbsii commented on code in PR #3810:
URL: https://github.com/apache/accumulo/pull/3810#discussion_r1347999615


##########
core/src/main/java/org/apache/accumulo/core/security/Authorizations.java:
##########
@@ -43,11 +43,11 @@
 public class Authorizations implements Iterable<byte[]>, Serializable, 
AuthorizationContainer {
 
   private static final long serialVersionUID = 1L;
-  private static final Set<ByteSequence> EMPTY_AUTH_SET = 
Collections.emptySet();
-  private static final List<byte[]> EMPTY_AUTH_LIST = Collections.emptyList();
+  private static final HashSet<ByteSequence> EMPTY_AUTH_SET = new HashSet<>();
+  private static final ArrayList<byte[]> EMPTY_AUTH_LIST = new ArrayList<>();

Review Comment:
   `Set.of()` and `List.of()` have issues with `.contains(null)`, so can be 
annoying (they throw an exception rather than return false). They might work 
here if they are serializable, but I'm not sure. We could certainly get rid of 
the variables and just use the emptyList or emptySet instead, though.
   
   However, I'm very confused about the error, because these should be static 
fields, not instance fields, so shouldn't be serialized with the instance 
anyway. But, if I'm confused about that, it seems the simplest fix is to just 
mark them transient, so they are excluded from serialization. They are already 
initialized when the class is loaded, so it shouldn't be an issue.



-- 
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: notifications-unsubscr...@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to