You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trying to make method validation work using Hibernate Validator 4.3.0.
Running the very same code over and over again yields different results. Sometimes everything gets validated. Sometimes not. And occasionally I'm getting an unexpected exception.
I've prepared a test case. Simply run maven "install test".
I'm aware I might be barking at the wrong tree here. Maybe it's not Spring's plumbing that is to blame. But rather HV. On the other hand, this are quite straightforward cases...
Since you're making heavy use of generics there, I suspect that what you're seeing is a bridge method problem where the runtime invocation may come in as a compiler-generated bridge method instead of the originally declared method. The bridge method won't have any annotations on it, so method validation would obviously fail then.
However, unfortunately, I'm getting mixed results even with an explicit call to our BridgeMethodResolver. Maybe it is picking up the method from the sub-interface as opposed to the base interface and only finding the constraint annotations in one but not the other case. A JVM is quite free to play games with reflection here.
This turns out to be rather involved, and indeed only occuring for generically typed methods. We'll certainly do something about it (if Hibernate Validator itself doesn't, since it could resolve such an ambiguous Method handle as well), but probably only in the 4.x line.
I cannot reproduce this against Hibernate Validator 5.x on JDK 8 anymore, going through the Bean Validation 1.1 method validation API. So I assume this has been addressed on Hibernate Validator's side in the meantime.
Jan Goyvaerts opened SPR-10384 and commented
Trying to make method validation work using Hibernate Validator 4.3.0.
Running the very same code over and over again yields different results. Sometimes everything gets validated. Sometimes not. And occasionally I'm getting an unexpected exception.
I've prepared a test case. Simply run maven "install test".
I'm aware I might be barking at the wrong tree here. Maybe it's not Spring's plumbing that is to blame. But rather HV. On the other hand, this are quite straightforward cases...
Running on Linux x64 (Arch) & JDK 1.6.0_43.
Affects: 3.2.2
Attachments:
Issue Links:
0 votes, 6 watchers
The text was updated successfully, but these errors were encountered: