You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (JIRA)" <ji...@apache.org> on 2017/11/09 11:55:00 UTC
[jira] [Commented] (GROOVY-7315) CompileStatic/TypeChecked cannot
create non-static nested inner class using named-arg short-hand syntax
[ https://issues.apache.org/jira/browse/GROOVY-7315?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16245529#comment-16245529 ]
Paul King commented on GROOVY-7315:
-----------------------------------
Workaround:
{code}
Y makeY() {
// new Y(a:1)
def y = new Y()
y.a = 1
y
}
{code}
> CompileStatic/TypeChecked cannot create non-static nested inner class using named-arg short-hand syntax
> -------------------------------------------------------------------------------------------------------
>
> Key: GROOVY-7315
> URL: https://issues.apache.org/jira/browse/GROOVY-7315
> Project: Groovy
> Issue Type: Bug
> Components: Static Type Checker
> Affects Versions: 2.3.9, 2.4.1
> Reporter: Jason Winnebeck
>
> {code}
> @groovy.transform.CompileStatic
> class X {
> Y makeY() {
> new Y(a:1)
> }
>
> private class Y {
> int a
> }
> }
> println new X().makeY()
> {code}
> Error:
> {noformat}
> [Static type checking] - Cannot find matching method X$Y#<init>(X, java.util.LinkedHashMap <java.lang.String, java.lang.Integer>). Please check if the declared type is right and if the method exists.
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)