commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Charles Honton (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (BCEL-237) non-empty final arrays should be private as they are mutable
Date Wed, 12 Aug 2015 15:28:46 GMT

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

Charles Honton commented on BCEL-237:
-------------------------------------

I have started to work on an enum to replace most of the constants defined in arrays.  There
are a couple of design concerns:

1. It''s difficult to determine which constants are expected to be used as part of BCEL's
interface and which constants are purely implementation detail.  What clues will we use to
determine what was expected to be externally available?

2. Replacing constants with enums breaks source compatibility as well as binary compatibility.
 Do we deprecate the constant and implement in terms of the enum; Or, do we just remove the
constants?

> non-empty final arrays should be private as they are mutable
> ------------------------------------------------------------
>
>                 Key: BCEL-237
>                 URL: https://issues.apache.org/jira/browse/BCEL-237
>             Project: Commons BCEL
>          Issue Type: Bug
>            Reporter: Sebb
>            Assignee: Charles Honton
>             Fix For: 6.0
>
>
> Final array elements are not themselves final.
> So any final arrays should always be private, otherwise external code can corrupt the
entries accidentally or deliberately.
> Either the array can be accessed through a getter that clones the contents, or the entries
can be accessed through a getter that returns a single entry.
> This issue affects:
> Constants.class:
> CONSTANT_NAMES
> ACCESS_NAMES
> INTERFACES_IMPLEMENTED_BY_ARRAYS
> TYPE_NAMES
> CLASS_TYPE_NAMES
> SHORT_TYPE_NAMES
> NO_OF_OPERANDS
> TYPE_OF_OPERANDS
> OPCODE_NAMES
> CONSUME_STACK
> PRODUCE_STACK
> ATTRIBUTE_NAMES
> ITEM_NAMES
> METHODHANDLE_NAMES



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message