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

Paul King updated GROOVY-7867:
------------------------------
    Fix Version/s:     (was: 3.x)
                   4.x

> asType(Collection col, Class clazz) ingnores exceptions in clazz constructor
> ----------------------------------------------------------------------------
>
>                 Key: GROOVY-7867
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7867
>             Project: Groovy
>          Issue Type: Bug
>          Components: groovy-runtime
>    Affects Versions: 2.4.3, 2.4.4, 2.4.5, 2.4.6, 2.4.7, 2.4.8, 3.x, 
> 2.5.0-beta-1
>         Environment: no matter
>            Reporter: Pavel Novichenko
>            Priority: Major
>             Fix For: 4.x
>
>
> Method ignores exception in clazz constructor, and if any - throws exception 
> later, when try find constructor with args matches collection items.
> public static <T> T asType(Collection col, Class<T> clazz) in 
> DefaultGroovyMethods.java, line 10623:
> {code:title=DefaultGroovyMethods.java|borderStyle=solid}
>         Object[] args = {col};
>         try {
>             return (T) InvokerHelper.invokeConstructorOf(clazz, args);
>         } catch (Exception e) {
>             // ignore, the constructor that takes a Collection as an argument 
> may not exist
>         }
> {code}
> In my opinion, should ignore only if such constroctor not found



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to