This is an automated email from the ASF dual-hosted git repository.
dlmarion pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/accumulo-access.git
The following commit(s) were added to refs/heads/main by this push:
new a5fe89f Reverted AuthorizationsImpl back to class, made ctor pkg
private (#111)
a5fe89f is described below
commit a5fe89fe4644845ecddd2e10d980d0d7277195ff
Author: Dave Marion <[email protected]>
AuthorDate: Wed Mar 11 16:46:02 2026 -0400
Reverted AuthorizationsImpl back to class, made ctor pkg private (#111)
Reverted AuthorizationsImpl back to a class from a record type
to allow for making the constructor package private. Removed
Serializable from Authorizations interface to reduce copies in
the Impl.
---
.../org/apache/accumulo/access/Authorizations.java | 3 +--
.../accumulo/access/impl/AuthorizationsImpl.java | 28 +++++++++++++++++-----
.../accumulo/access/tests/AuthorizationTest.java | 3 ++-
3 files changed, 25 insertions(+), 9 deletions(-)
diff --git
a/modules/core/src/main/java/org/apache/accumulo/access/Authorizations.java
b/modules/core/src/main/java/org/apache/accumulo/access/Authorizations.java
index f3945d7..eb5b783 100644
--- a/modules/core/src/main/java/org/apache/accumulo/access/Authorizations.java
+++ b/modules/core/src/main/java/org/apache/accumulo/access/Authorizations.java
@@ -18,7 +18,6 @@
*/
package org.apache.accumulo.access;
-import java.io.Serializable;
import java.util.Set;
/**
@@ -29,6 +28,6 @@ import java.util.Set;
*
* @since 1.0.0
*/
-public interface Authorizations extends Iterable<String>, Serializable {
+public interface Authorizations extends Iterable<String> {
Set<String> asSet();
}
diff --git
a/modules/core/src/main/java/org/apache/accumulo/access/impl/AuthorizationsImpl.java
b/modules/core/src/main/java/org/apache/accumulo/access/impl/AuthorizationsImpl.java
index 6ad1d46..348d54e 100644
---
a/modules/core/src/main/java/org/apache/accumulo/access/impl/AuthorizationsImpl.java
+++
b/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;
+ }
+
+ @Override
+ public int hashCode() {
+ return authorizations.hashCode();
+ }
+
+ @Override
+ public String toString() {
+ return authorizations.toString();
+ }
+
/**
* Returns the set of authorization strings in this Authorization object
*
diff --git
a/modules/core/src/test/java/org/apache/accumulo/access/tests/AuthorizationTest.java
b/modules/core/src/test/java/org/apache/accumulo/access/tests/AuthorizationTest.java
index 0fe6cfc..171abc7 100644
---
a/modules/core/src/test/java/org/apache/accumulo/access/tests/AuthorizationTest.java
+++
b/modules/core/src/test/java/org/apache/accumulo/access/tests/AuthorizationTest.java
@@ -59,7 +59,8 @@ public class AuthorizationTest {
// check if new object is allocated
assertSame(access.newAuthorizations(Set.of()),
access.newAuthorizations(Set.of()));
assertEquals(Set.of(), access.newAuthorizations(Set.of()).asSet());
- assertSame(Set.of(), access.newAuthorizations(Set.of()).asSet());
+ assertSame(access.newAuthorizations(Set.of()).asSet(),
+ access.newAuthorizations(Set.of()).asSet());
}
@Test