I create an web application on tomcat server with spring framework and hibernate validation.
I have an interface which define method with javax.validation Annotations.
We have an Aspect to validate method parameters for interfaces.
Sometime we will get the wrong result and a ConstraintDeclarationException is thrown.
I checked that all use same classloader. This also happen with debugger but if I evaluate toString for one of class the result will be correct.
With 14.0.2 I didn't see this behaviour. After Upgrade to jdk15 this will occurs often after restart the server.
If I debug it and set a breakpoint at MethodConfigurationRule the the error will not occurs
Windows 10 and macOS Catalina
use Spring 5.2.9, Hibernate Validator 6.1.5, use AOP to validate parameters
Runs on Tomcat 9.0.38
fails with jdk15-ea+16-681, jdk15+36-1562, 16-ea+16-712
compiled with JDK11 (class version 55)
Reported also in openjdk: https://bugs.openjdk.java.net/browse/JDK-8253566?
add sample to github
We had a close look with Gunnar today and it looks like a JDK 15 issue. We are in contact with the JDK team about this.
Quick update, Alexey Shipilev is bisecting OpenJDK builds/commits atm, we supspect https://bugs.openjdk.java.net/browse/JDK-8238691 is the culprit. Can you try running with -XX:+ExpandSubTypeCheckAtParseTime, this may be a workaround for the time being.
On first test it work with -XX:+UnlockDiagnosticVMOptions -XX:+ExpandSubTypeCheckAtParseTime
We confirmed it's a JDK issue. I'm closing this one.
Thanks for reporting!