You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by "dlmarion (via GitHub)" <gi...@apache.org> on 2026/03/11 18:59:03 UTC

[PR] Authorizations public ctor [accumulo-access]

dlmarion opened a new pull request, #111:
URL: https://github.com/apache/accumulo-access/pull/111

   (no comment)


-- 
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-unsubscribe@accumulo.apache.org

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


Re: [PR] Authorizations public ctor [accumulo-access]

Posted by "ctubbsii (via GitHub)" <gi...@apache.org>.
ctubbsii commented on code in PR #111:
URL: https://github.com/apache/accumulo-access/pull/111#discussion_r2933501145


##########
modules/core/src/main/java/org/apache/accumulo/access/impl/AuthorizationsImpl.java:
##########
@@ -18,23 +18,39 @@
  */
 package org.apache.accumulo.access.impl;
 
-import java.io.Serial;
 import java.util.Iterator;
 import java.util.Set;
 
 import org.apache.accumulo.access.Authorizations;
 
-public record AuthorizationsImpl(Set<String> authorizations) implements Authorizations {
-
-  @Serial
-  private static final long serialVersionUID = 1L;
+public class AuthorizationsImpl implements Authorizations {
 
   static final Authorizations EMPTY = new AuthorizationsImpl(Set.of());
 
-  public AuthorizationsImpl(Set<String> authorizations) {
+  private final Set<String> authorizations;
+
+  AuthorizationsImpl(Set<String> authorizations) {
     this.authorizations = Set.copyOf(authorizations);
   }
 
+  @Override
+  public boolean equals(Object o) {
+    if (o instanceof AuthorizationsImpl oa) {
+      return authorizations.equals(oa.authorizations);
+    }
+    return false;

Review Comment:
   Applied in 52350947b2729368e8cfc3e9101e3dda896970b6



-- 
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-unsubscribe@accumulo.apache.org

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


Re: [PR] Authorizations public ctor [accumulo-access]

Posted by "dlmarion (via GitHub)" <gi...@apache.org>.
dlmarion commented on code in PR #111:
URL: https://github.com/apache/accumulo-access/pull/111#discussion_r2920832659


##########
modules/core/src/main/java/org/apache/accumulo/access/impl/AuthorizationsImpl.java:
##########
@@ -19,20 +19,43 @@
 package org.apache.accumulo.access.impl;
 
 import java.io.Serial;
+import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Set;
 
 import org.apache.accumulo.access.Authorizations;
 
-public record AuthorizationsImpl(Set<String> authorizations) implements Authorizations {
+public class AuthorizationsImpl implements Authorizations {
 
   @Serial
   private static final long serialVersionUID = 1L;
 
+  private static final HashSet<String> EMPTY_SET = new HashSet<>();

Review Comment:
   Removed in 369b9e1, this was added due to the test. Modified the test



-- 
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-unsubscribe@accumulo.apache.org

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


Re: [PR] Authorizations public ctor [accumulo-access]

Posted by "dlmarion (via GitHub)" <gi...@apache.org>.
dlmarion commented on code in PR #111:
URL: https://github.com/apache/accumulo-access/pull/111#discussion_r2924285049


##########
modules/core/src/main/java/org/apache/accumulo/access/Authorizations.java:
##########
@@ -18,7 +18,6 @@
  */
 package org.apache.accumulo.access;
 
-import java.io.Serializable;

Review Comment:
   > Was there a reason we didn't want this serializable anymore?
   
   Making this class Serializable meant that we had to use a mutable Set implementation in the class (HashSet) and copy the provided set in the constructor and also copy the set to return it in the call to `asSet`. @keith-turner suggested just removing Serializable here and let the user do the serialization themselves if the needed it as it's just a set of strings.
   
   > I see AccessExpression is still Serializable. Should we remove that too?
   
   We should probably evaluate the classes to see if code complexity and object copying is reduced by implementing [Externalizable](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/io/Externalizable.html) instead of Serializable for Authorizations and AccessExpression. This should allow us to use `Set.copy()` and other non-Serializable immutable types in our code and we just manage the serialization logic ourselves (which may rarely be invoked). 



-- 
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-unsubscribe@accumulo.apache.org

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


Re: [PR] Authorizations public ctor [accumulo-access]

Posted by "keith-turner (via GitHub)" <gi...@apache.org>.
keith-turner commented on code in PR #111:
URL: https://github.com/apache/accumulo-access/pull/111#discussion_r2920800671


##########
modules/core/src/main/java/org/apache/accumulo/access/impl/AuthorizationsImpl.java:
##########
@@ -19,20 +19,43 @@
 package org.apache.accumulo.access.impl;
 
 import java.io.Serial;
+import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Set;
 
 import org.apache.accumulo.access.Authorizations;
 
-public record AuthorizationsImpl(Set<String> authorizations) implements Authorizations {
+public class AuthorizationsImpl implements Authorizations {
 
   @Serial
   private static final long serialVersionUID = 1L;
 
+  private static final HashSet<String> EMPTY_SET = new HashSet<>();

Review Comment:
   This set does not seem needed because of the way `AccessImpl.newAuthorizations()` works it will only ever create a single instance of AuthorizationsImpl for the empty set.   Seems like this class could have no specialization for the empty set and rely on the existing specialization in AccessImpl
   
   ```suggestion
   ```



-- 
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-unsubscribe@accumulo.apache.org

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


Re: [PR] Authorizations public ctor [accumulo-access]

Posted by "keith-turner (via GitHub)" <gi...@apache.org>.
keith-turner commented on code in PR #111:
URL: https://github.com/apache/accumulo-access/pull/111#discussion_r2920800671


##########
modules/core/src/main/java/org/apache/accumulo/access/impl/AuthorizationsImpl.java:
##########
@@ -19,20 +19,43 @@
 package org.apache.accumulo.access.impl;
 
 import java.io.Serial;
+import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Set;
 
 import org.apache.accumulo.access.Authorizations;
 
-public record AuthorizationsImpl(Set<String> authorizations) implements Authorizations {
+public class AuthorizationsImpl implements Authorizations {
 
   @Serial
   private static final long serialVersionUID = 1L;
 
+  private static final HashSet<String> EMPTY_SET = new HashSet<>();

Review Comment:
   This set does not seem needed because of the way `AccessImpl.newAuthorizations()` works it will only ever create a single instance of AuthorizationsImpl for the empty set.   Seems like this class could have specialization for the empty set and rely on the existing specialization in AccessImpl
   
   ```suggestion
   ```



-- 
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-unsubscribe@accumulo.apache.org

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


Re: [PR] Authorizations public ctor [accumulo-access]

Posted by "dlmarion (via GitHub)" <gi...@apache.org>.
dlmarion merged PR #111:
URL: https://github.com/apache/accumulo-access/pull/111


-- 
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-unsubscribe@accumulo.apache.org

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


Re: [PR] Authorizations public ctor [accumulo-access]

Posted by "ctubbsii (via GitHub)" <gi...@apache.org>.
ctubbsii commented on code in PR #111:
URL: https://github.com/apache/accumulo-access/pull/111#discussion_r2921646394


##########
modules/core/src/main/java/org/apache/accumulo/access/impl/AuthorizationsImpl.java:
##########
@@ -18,23 +18,39 @@
  */
 package org.apache.accumulo.access.impl;
 
-import java.io.Serial;
 import java.util.Iterator;
 import java.util.Set;
 
 import org.apache.accumulo.access.Authorizations;
 
-public record AuthorizationsImpl(Set<String> authorizations) implements Authorizations {
-
-  @Serial
-  private static final long serialVersionUID = 1L;
+public class AuthorizationsImpl implements Authorizations {
 
   static final Authorizations EMPTY = new AuthorizationsImpl(Set.of());
 
-  public AuthorizationsImpl(Set<String> authorizations) {
+  private final Set<String> authorizations;
+
+  AuthorizationsImpl(Set<String> authorizations) {
     this.authorizations = Set.copyOf(authorizations);
   }
 
+  @Override
+  public boolean equals(Object o) {
+    if (o instanceof AuthorizationsImpl oa) {
+      return authorizations.equals(oa.authorizations);
+    }
+    return false;

Review Comment:
   Small improvement:
   
   ```suggestion
       return this == o || (o instanceof AuthorizationsImpl oa && authorizations.equals(oa.authorizations));
   ```



-- 
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-unsubscribe@accumulo.apache.org

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


Re: [PR] Authorizations public ctor [accumulo-access]

Posted by "ctubbsii (via GitHub)" <gi...@apache.org>.
ctubbsii commented on code in PR #111:
URL: https://github.com/apache/accumulo-access/pull/111#discussion_r2921655299


##########
modules/core/src/main/java/org/apache/accumulo/access/Authorizations.java:
##########
@@ -18,7 +18,6 @@
  */
 package org.apache.accumulo.access;
 
-import java.io.Serializable;

Review Comment:
   Was there a reason we didn't want this serializable anymore?
   
   I see AccessExpression is still Serializable. Should we remove that too?



-- 
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-unsubscribe@accumulo.apache.org

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