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

[jira] [Commented] (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=16472909#comment-16472909 ] 

ASF GitHub Bot commented on GROOVY-7883:
----------------------------------------

GitHub user danielsun1106 opened a pull request:

    https://github.com/apache/groovy/pull/705

    GROOVY-7883  Static compiler prefers private constructor over public …

    …if private matches be

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/danielsun1106/groovy GROOVY-7883

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/groovy/pull/705.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #705
    
----
commit 394db983d51446f849205efc4f9cca21601cc47c
Author: Daniel Sun <re...@...>
Date:   2018-05-12T04:35:01Z

    GROOVY-7883  Static compiler prefers private constructor over public if private matches be

----


> 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
>            Priority: Major
>
> 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)