[ 
https://issues.apache.org/jira/browse/CRYPTO-129?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Sebb reopened CRYPTO-129:
-------------------------

Protected fields should be avoided if possible.

Once exposed as part of the API, that constrains future development.
For example, if a protected field needs to be changed from an int to a long, 
that cannot be done without breaking the API.
Or if the code is changed and no longer needs the field, it still has to be 
maintained or the functionality may be broken.

And protected mutable fields should never be used in new code.
It's impossible to ensure thread-safety if there are any exposed mutable fields.
So for example only empty arrays can ever be safely exposed.

Only constants should be exposed, and only if they really are constants that 
will never change. Otherwise one can run into problems with constant embedding 
- the Java compiler can take copies of constants from one class to another.

> Change access of instance variables from package private to private (or 
> protected if appropriate)
> -------------------------------------------------------------------------------------------------
>
>                 Key: CRYPTO-129
>                 URL: https://issues.apache.org/jira/browse/CRYPTO-129
>             Project: Commons Crypto
>          Issue Type: Bug
>    Affects Versions: 1.0.0
>            Reporter: Gary Gregory
>            Assignee: Jianguo Tian
>             Fix For: 1.1.0
>
>
> Change access of instance variables from package private to private (or 
> protected if appropriate).



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to