[dna-issues] [JBoss JIRA] Closed: (DNA-163) Most, if not all, of the assertions in BasicMultiValueProperty are incorrect.

Randall Hauch (JIRA) jira-events at lists.jboss.org
Fri Jul 11 16:35:26 EDT 2008


     [ http://jira.jboss.com/jira/browse/DNA-163?page=all ]

Randall Hauch closed DNA-163.
-----------------------------

    Resolution: Done

The assertions were indeed correct, but they were misplaced and should instead be in the constructors.  The BasicEmptyProperty class should be used for properties that have no values; the BasicSingleValueProperty should be used for properties that have just a single value (which may be null); and the BasicMultiValueProperty should be used for properties that contain 2+ values.  This is done to minimize the memory footprint: if a single Property implementation were used, it would have to support multiple values, but in reality most properties will be properties with one a single value and therefore the extra collection is simply wasted memory.  By having different implementations for the different situations, we're able to hold onto the values with the most efficiency.  Also, since the objects are intended to be immutable, there is no need to support changing the values.  This description was added to the JavaDoc.

This relies upon a new ArgCheck method, which was added with tests (along with several other similar methods).

Marking the issue as closed, since QA cannot verify the change in assertions.

> Most, if not all, of the assertions in BasicMultiValueProperty are incorrect.
> -----------------------------------------------------------------------------
>
>                 Key: DNA-163
>                 URL: http://jira.jboss.com/jira/browse/DNA-163
>             Project: DNA
>          Issue Type: Bug
>          Components: SPI
>    Affects Versions: 0.1
>            Reporter: Johnny Verhaeg
>         Assigned To: Randall Hauch
>             Fix For: 0.2
>
>   Original Estimate: 0 minutes
>  Remaining Estimate: 0 minutes
>
> They definitely should not exist in the "is" methods, as they violate the contract described by the JavaDocs.  If the values parameter passed into the constructor is null, either an assertion error should be thrown, an empty list should be created, or the various methods should handle the null value without throwing an exception.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the dna-issues mailing list