Good annotations in groovy class marked red

the following annotations compile and work correctly but are marked as invalid with "Expression expected" in IDEA


@ValidateNestedProperties([
@Validate(field="username", required=true, on=["save"], minlength=3, maxlength=20),
@Validate(field="password", required=true, on=["save"], minlength=5, maxlength=20),
@Validate(field="email", required=true, on=["save"], minlength=5, maxlength=20),
])
UserBean user

6 comments
Comment actions Permalink

Actually this a bug with groovy syntax spec at http://groovy.codehaus.org/jsr/spec/grammar/#annotation. We went out of our usual way of behaving according to the spec and corrected this in jetgroovy 1.5 (i.e. trunk) The build will be available in the nearest days.

Eugene.

0
Comment actions Permalink

No, this should not be valid: this is a result of a closure being parsed in groovy - but that is probably not what you want, use curly braces instead.

Eugene.

0
Comment actions Permalink

I'm not sure what you mean... curly braces instead of the square brackets? the code compiles and acts as expected..

0
Comment actions Permalink

Yes, I consulted groovy devs, and they say the switch from java-style curly braces to squares ones was made intentionally.

0
Comment actions Permalink

cool.

So this should be fixed in 1.5?

0

Please sign in to leave a comment.