You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Daniel Sun (JIRA)" <ji...@apache.org> on 2018/05/12 07:33:00 UTC

[jira] [Comment Edited] (GROOVY-7883) Static compiler prefers private constructor over public if private matches better

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

Daniel Sun edited comment on GROOVY-7883 at 5/12/18 7:32 AM:
-------------------------------------------------------------

Fixed by https://github.com/apache/groovy/commit/b1d1232770aade9672668df4dbc6aa2e2076fa9e
https://github.com/apache/groovy/commit/6560ce8e5541e4333a418d8dcf7f0f5ae92a71d0


was (Author: daniel_sun):
Fixed by https://github.com/apache/groovy/commit/b1d1232770aade9672668df4dbc6aa2e2076fa9e

> 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
>            Assignee: Daniel Sun
>            Priority: Major
>             Fix For: 2.6.0-alpha-4, 3.0.0-alpha-3, 2.5.0-rc-3
>
>
> 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
(v7.6.3#76005)