[ 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 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 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 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} > 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 > 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 (v6.3.4#6332)