[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-1362?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13187212#comment-13187212
 ] 

Edward Ribeiro commented on ZOOKEEPER-1362:
-------------------------------------------

All three fields are declared as follows:

public final ArrayList<ACL> OPEN_ACL_UNSAFE = new ArrayList<ACL>(               
 Collections.singletonList(new ACL(Perms.ALL, ANYONE_ID_UNSAFE)));

The change would be a matter of just removing the ArrayList and declaring the 
field as a List as Collections.singletonList() already returns an immutable 
collection:

public final List<ACL> OPEN_ACL_UNSAFE = Collections.singletonList(new 
ACL(Perms.ALL, ANYONE_ID_UNSAFE));

Unfortunately, they are public fields, so I suppose it could pontentially broke 
many client apps that are referencing this field as 

ArrayList<ACL> perms = ZooDefs.Ids.OPEN_ACL_UNSAFE;

I still think this change is doable, but I would like to hear what other people 
think. :)
                
> ZooDefs.Ids ACL lists not immutable
> -----------------------------------
>
>                 Key: ZOOKEEPER-1362
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1362
>             Project: ZooKeeper
>          Issue Type: Improvement
>          Components: java client
>            Reporter: Tassos Souris
>            Priority: Trivial
>
> In org.apache.zookeeper:
>       1) ZooDefs.Ids.OPEN_ACL_UNSAFE
>       2) ZooDefs.Ids.CREATOR_ALL_ACL
>       3) ZooDefs.Ids.READ_ALL_ACL
> are not immutable lists. Unlikely but the client could alter them.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to