Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B8EC81942A for ; Thu, 28 Apr 2016 08:09:13 +0000 (UTC) Received: (qmail 30712 invoked by uid 500); 28 Apr 2016 08:09:13 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 30339 invoked by uid 500); 28 Apr 2016 08:09:13 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 30310 invoked by uid 99); 28 Apr 2016 08:09:13 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 Apr 2016 08:09:13 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 115632C1F60 for ; Thu, 28 Apr 2016 08:09:13 +0000 (UTC) Date: Thu, 28 Apr 2016 08:09:13 +0000 (UTC) From: "Ferdinand Xu (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Work started] (CRYPTO-30) Mutable fields should be private MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CRYPTO-30?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Work on CRYPTO-30 started by Ferdinand Xu. ------------------------------------------ > Mutable fields should be private > -------------------------------- > > Key: CRYPTO-30 > URL: https://issues.apache.org/jira/browse/CRYPTO-30 > Project: Commons Crypto > Issue Type: Bug > Components: Stream > Reporter: Sebb > Assignee: Ferdinand Xu > > Mutable fields should be private or possibly package-protected, never protected or public. > Once a field is published, it's impossible to ensure that it is properly synchronised, and it is impossible to change the implementation without API breakage. > Only constants should be published. > If there is really a need to access the field externally, this should be done through getters/setters, as those allow synchronisation to be added and make it easier to change the implementation. > Also, it's easy to add a getter/setter later if access is found to be needed. > Don't add one 'just in case' because it cannot easily be removed. > This observation applies to: > StreamOutput.out > CTRCipherInputStream.streamOffset > CTRCipherOutputStream.streamOffset > CipherInputStream - lots of protected mutable state > CipherOutputStream - ditto -- This message was sent by Atlassian JIRA (v6.3.4#6332)