[ 
https://issues.apache.org/jira/browse/GROOVY-7883?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15514452#comment-15514452
 ] 

Juan Martín Sotuyo Dodero commented on GROOVY-7883:
---------------------------------------------------

I'm seeing the exact same problem. new AssertionError("any string") is valid 
java code calling AssertionError(java.lang.Object). Groovy with @CompileStatic 
fails due to private constructor AssertionError(java.lang.String).

> 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)

Reply via email to