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

Shil Sinha commented on GROOVY-6468:
------------------------------------

This should only be an issue for private constructors, as other private methods 
are accessed using bridge methods.

> Unable to call private method/constructor from static inner class with 
> @CompileStatic
> -------------------------------------------------------------------------------------
>
>                 Key: GROOVY-6468
>                 URL: https://issues.apache.org/jira/browse/GROOVY-6468
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static compilation
>    Affects Versions: 2.1.9, 2.2.1, 2.3.0, 2.4.0-rc-1
>            Reporter: Adam Brown
>            Assignee: Cédric Champeau
>
> {code}
> @groovy.transform.CompileStatic
> class Client {
>       static class Builder {
>               int a
>               Client build() {
>                       return new Client(a)
>               }
>       }
>       int b
>       private Client(int b) {
>               this.b = b
>       }
> }
> final client = new Client.Builder(a : 1).build()
> println client.b
> {code}
> produces the error
> {code}
> Caught: java.lang.IllegalAccessError: tried to access method 
> Client.<init>(I)V from class Client$Builder
> java.lang.IllegalAccessError: tried to access method Client.<init>(I)V from 
> class Client$Builder
>       at Client$Builder.build(test1.groovy:7)
>       at Client$Builder$build.call(Unknown Source)
>       at test1.run(test1.groovy:17)
> {code}
> but produces the correct result (1), without the @CompileStatic



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to