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

0
6 comments
Avatar
Permanently deleted user

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
Avatar
Permanently deleted user

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
Avatar
Permanently deleted user

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

0
Avatar
Permanently deleted user

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

0
Avatar
Permanently deleted user

cool.

So this should be fixed in 1.5?

0
Avatar
Permanently deleted user

Yes, indeed.

0

Please sign in to leave a comment.