There are lots of aspects to JSR 303 that aren't very compatible with lombok.
* Making your own validation annotations with their own validator class: Lombok does not have resolution (or at least, I'd rather not try and glue resolution into this feature). We simply wouldn't know that @ZipCode is a custom validation annotation, which results in the very very bad end result of the verifier method simply not checking this, without any visual feedback that it isn't happening.
* Validation restrictions are inherited. Again, without resolution, we'd be silently omitting required calls.
* In general it looks like the idea of JSR 303 is that you call into some sort of validation framework to do your validating for you; it will scan the class for the annotations and apply these to the fields directly using reflection. That seems like a MUCH more sensible way to handle validation.
Wouldn't it be a lot easier all around that those who need validation use a library to do so? Perhaps lombok can help you out and generate an init() method with the call to the validation framework inside it?
The showstopper issue I have with re-using the JSR 303 annotations is that this would get two things wrong:
* It creates the impression that lombok is an implementation (of sorts) of a JSR 303 validator, but we can't do most of the spec, so actually we're just using a few of their annotations but 'This is a JSR-303 style validator' is entirely the wrong mindset. This is a pretty serious violation of the principle of least surprise.
* Where-ever there is a mismatch between what the programmer expects would happen, and what lombok actually does, it is likely that nobody knows things are awry; errors in validation are usually not spotted unless you have an explicit test for every violation, and we don't live in the ponies and rainbow world where everyone has 100% test coverage for all code, all the time. Violating the principle of least surprise is one thing. Failing silently when things go wrong? Unacceptable.
At the same time, I really don't think we should reinvent the wheel on this, which means I'm now strongly considering this feature to not be a feasible plan. If you need validation, use a framework to do that; lombok cannot help in a way that wouldn't be highly confusing.
So, is there something we can generate to call into a standard framework or two? We have the extern package just for this: To help reduce boilerplate involved in writing against third party libraries.