Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Duplicate
-
2.1.9, 2.2.1, 2.3.0, 2.4.0-rc-1
-
None
Description
@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
produces the error
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)
but produces the correct result (1), without the @CompileStatic
Attachments
Issue Links
- duplicates
-
GROOVY-7932 Cannot call private constructor from closures with @CompileStatic
- Closed
- relates to
-
GROOVY-7932 Cannot call private constructor from closures with @CompileStatic
- Closed