提交 a5ca50d0 编写于 作者: K Kohsuke Kawaguchi

did some more experiments only to hit additional problems

上级 46f603d2
......@@ -44,6 +44,53 @@ contributor(ctx) {
}
}
/*
Adding methods that's not defined in Java works, but trying to define a method of the same name
as Java doesn't. See http://youtrack.jetbrains.com/issue/IDEA-108355
One work around that appears to work is to add a dummy 2nd parameter.
TO BE FILED:
Title: GDSL: With named parameter type information, undefined properties should be flagged
IDEA-71141 adds the named parameter support. However, I did a bit of experiments and noticed that if I
type in the parameter name that's not defined in the source code, IDEA does not flag it as undefined.
Example:
my.gdsl:
{code}
contributor(context(ctype:"my.Foo")) {
def named = [
parameter(name: 'a', type: Integer),
parameter(name: 'b', type: Integer)
]
method name: "bar", type: void, params:[args:named]
}
{code}
something.groovy:
{code}
Foo foo = new Foo();
foo.bar(a:1, b:2, c:3)
{code}
If I give a string value to the "a" argument, that gets flagged as a type error, so I know that the GDSL
definition is taking an effect. It just appears to be lacking a validation for undefined argument names.
In my humble opinion, this significantly reduces the value of defining named argument type information.
It should be either made a warning just like incorrect type, or it should be the same underscore given
to any undefined property access/method invocations.
*/
// experiment
contributor(context(ctype:"lib.FormTagLib")) {
def named = [
parameter(name: 'param1', type: String, doc: 'My doc'),
parameter(name: 'param2', type: Integer),
]
method name: "textbox3", type: void, params:[args:named, c:Closure]
}
// Record of past experiments
/*
try to infer "it" from the class name of Groovy page
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册