diff --git a/core/src/main/resources/dsld/IntelliJ.gdsl b/core/src/main/resources/dsld/IntelliJ.gdsl index 19c6ada61b6a94139d5ea9aa271e66a15f8eaa18..e643112e4b1848862ec20be99f70cc30ac4810e0 100644 --- a/core/src/main/resources/dsld/IntelliJ.gdsl +++ b/core/src/main/resources/dsld/IntelliJ.gdsl @@ -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