[ https://issues.apache.org/jira/browse/GROOVY-7883?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15424311#comment-15424311 ]
Jochen Theodorou commented on GROOVY-7883: ------------------------------------------ I did read this as "private constructor is taken instead of the public one", which means the access modifier restriction is ignored. This would be wrong > Static compiler prefers private constructor over public if private matches > better > --------------------------------------------------------------------------------- > > Key: GROOVY-7883 > URL: https://issues.apache.org/jira/browse/GROOVY-7883 > Project: Groovy > Issue Type: Bug > Components: Static compilation > Affects Versions: 2.4.7 > Reporter: Jason Winnebeck > > When constructing an AssertionError for example, it has a public constructor > taking Object and a private constructor taking String. The static compiler > "chooses" the private constructor over the public one and this results in a > compile error. > {code} > @groovy.transform.CompileStatic > void doIt() { > //Cannot call private constructor for java.lang.AssertionError. However, it > should call AssertionError(Object) > throw new AssertionError("abc") > } > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)