You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Jason Winnebeck (JIRA)" <ji...@apache.org> on 2016/07/07 15:45:11 UTC

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

Jason Winnebeck created GROOVY-7883:
---------------------------------------

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