Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 83041200AE9 for ; Tue, 3 May 2016 10:27:14 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 818DF1609F3; Tue, 3 May 2016 10:27:14 +0200 (CEST) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id D71841609F2 for ; Tue, 3 May 2016 10:27:13 +0200 (CEST) Received: (qmail 45034 invoked by uid 500); 3 May 2016 08:27: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 44983 invoked by uid 99); 3 May 2016 08:27:13 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 May 2016 08:27:13 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id DF8E02C14F4 for ; Tue, 3 May 2016 08:27:12 +0000 (UTC) Date: Tue, 3 May 2016 08:27:12 +0000 (UTC) From: "Ferdinand Xu (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (CRYPTO-31) Make fields final wherever possible MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Tue, 03 May 2016 08:27:14 -0000 [ https://issues.apache.org/jira/browse/CRYPTO-31?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Ferdinand Xu updated CRYPTO-31: ------------------------------- Affects Version/s: 0.9.2 > Make fields final wherever possible > ----------------------------------- > > Key: CRYPTO-31 > URL: https://issues.apache.org/jira/browse/CRYPTO-31 > Project: Commons Crypto > Issue Type: Improvement > Components: Stream > Affects Versions: 0.9.2 > Reporter: Sebb > Assignee: Ferdinand Xu > Priority: Minor > Fix For: 1.0.0 > > > Final fields are automatically thread safe if the object itself is not modified. > Whereas non-final fields are not necessarily thread-safe even if they are not mutated - this is because of the Java memory model. > There are several non-final fields that are not mutated once created. They should be made final to improve thread-safety. This is particularly important for static fields since they are more likely to be used by multiple threads. > Note: such changes will not affect the public API if the fields are private or package-protected. > The fields include: > JavaSecureRandom.instance > OpensslSecureRandom.fallback > OpensslSecureRandom.nativeEnabled > ChannelInput.channel > StreamInput.buf - since no point creating an instance if it is not going to be used for reading, might as well create the buffer up front > StreamOutput.bufferSize > StreamOutput.buf - as for StreamInput > StreamOutput.out - should also be private > static NativeCodeLoader.nativeCodeLoaded > static OSInfo.archMapping > static ReflectionUtils.classLoader -- This message was sent by Atlassian JIRA (v6.3.4#6332)