You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Павел Новиченко (JIRA)" <ji...@apache.org> on 2016/06/17 12:17:05 UTC

[jira] [Updated] (GROOVY-7867) asType(Collection col, Class clazz) ingnores exceptions in clazz constructor

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

Павел Новиченко updated GROOVY-7867:
------------------------------------
    Description: 
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 DefaulktGroovyMethods.java, line 10623:
{quote}
        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
        }
{quote}

  was:
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 DefaulktGroovyMethods.java, line 10623:
        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
        }


> 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, 2.x, 2.5.0-beta-1
>         Environment: no matter
>            Reporter: Павел Новиченко
>             Fix For: 2.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 DefaulktGroovyMethods.java, line 10623:
> {quote}
>         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
>         }
> {quote}



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