commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Benedikt Ritter (Updated) (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (SANDBOX-363) Check if value is of the correct type in Argument.argument( Class<T> type, V value )
Date Sat, 21 Jan 2012 16:13:40 GMT

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

Benedikt Ritter updated SANDBOX-363:
------------------------------------

    Attachment: SANDBOX-363.txt

I have implemented a patch for this issue, but it breaks an existing unit test in CunstructorTestCase.
For some reason
{code:java}
argument(Boolean.class, Boolean.TRUE);
{code}
works just fine, while
{code:java}
argument(Boolean.TYPE, Boolean.TRUE);
{code}
will give us a IllegalArgumentException. Please have a look at the type checking I implemented
in Argument.

I also added some java doc to Argument and added some parameter validation to Argument.getParametersTypes().
For this, I added checkNoneIsNull(T[] referneces,...) to Assertions. It basically calls checkNotNull
on every reference in the given array.

At last but not least I extended the jUnit Test for Argument and started to implement a test
for Assertion (note that validation of correct errorMsg and errorArgs processing is missing
atm).

I know, this is a lot for one tiny patch, but I had a good run ;-)
                
> Check if value is of the correct type in Argument.argument( Class<T> type, V value
)
> ------------------------------------------------------------------------------------
>
>                 Key: SANDBOX-363
>                 URL: https://issues.apache.org/jira/browse/SANDBOX-363
>             Project: Commons Sandbox
>          Issue Type: Improvement
>          Components: BeanUtils2
>    Affects Versions: Nightly Builds
>            Reporter: Benedikt Ritter
>            Priority: Minor
>         Attachments: SANDBOX-363.txt
>
>
> Although the compiler should check that value is always of the correct type, a programmatic
check should back this up.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message