You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Mauro Molinari (JIRA)" <ji...@apache.org> on 2017/05/08 09:36:04 UTC
[jira] [Created] (GROOVY-8179) Map-style constructor call, inner
class and static compilation
Mauro Molinari created GROOVY-8179:
--------------------------------------
Summary: Map-style constructor call, inner class and static compilation
Key: GROOVY-8179
URL: https://issues.apache.org/jira/browse/GROOVY-8179
Project: Groovy
Issue Type: Bug
Components: Static compilation
Affects Versions: 2.4.11
Reporter: Mauro Molinari
Consider the following:
{code}
package c
import groovy.transform.CompileStatic
@CompileStatic
class C {
class MyBean {
String foo
int bar
}
class AnotherClass {
int createInt() {
return 1
}
String createString() {
return 'foo'
}
}
void doSomething() {
def a = new AnotherClass()
def b = new MyBean(foo: a.createString())
}
}
{code}
The compiler complains on {{new MyBean(...)}}:
{noformat}
\src\main\groovy\c\C.groovy: 22: [Static type checking] - Cannot find matching method c.C$MyBean#<init>(c.C, java.util.LinkedHashMap <java.lang.String, java.lang.String>). Please check if the declared type is right and if the method exists.
@ line 22, column 11.
{noformat}
Changing it to {{new C.MyBean(...)}} works though.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)