I have started examining what is required for JSR 308 support in Groovy. It is one of those things which might make sense to ensure we support in the new grammar from the get go.
Current issues: https://issues.apache.org/jira/browse/GROOVY-8225 https://issues.apache.org/jira/browse/GROOVY-8226 With just a few tweaks (GROOVY-8226) we get some stuff for free since we had some bits geared up already. We can now start using some of the Java libraries which leverage the JSR, e.g.: ======>8====== @Grab('com.pholser:junit-quickcheck-generators:0.7') @Grab('com.pholser:junit-quickcheck-core:0.7') import com.pholser.junit.quickcheck.generator.InRange import com.pholser.junit.quickcheck.runner.JUnitQuickcheck import org.junit.runner.RunWith import com.pholser.junit.quickcheck.Property @RunWith(JUnitQuickcheck) class IntegerRanges { @Property void shouldHold(@InRange(min = "0", max = "9") Integer item) { item >= 0 && item <= 9 } } ======>8====== Which uses a property-based testing framework to call our assertion 100 times. It works in fact even with the old grammar once the plumbing changes are done. What we can't do at the moment is something like this: ======>8====== @Property void shouldAlsoHold(List<@InRange(min = "0", max = "9") Integer> items) { assert items.every{ it >= 0 && it <= 9 } } ======>8====== The grammar isn't expecting an annotation on the parameterized type. It fails for both the old and new parsers with slightly different error messages. I'll be taking a look at what else is required to make this work but if anyone has particular requirements or comments, or some part they would like to work on, please let me know. Cheers, Paul.
