Hibernate Validation fails with JDK15

Description

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.

see https://github.com/hibernate/hibernate-validator/blob/7987755f0617504b567f2a5a0437d8695659e4ce/engine/src/main/java/org/hibernate/validator/internal/metadata/aggregated/rule/MethodConfigurationRule.java#L73-L77

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

Environment:

  • 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?

Sample:

Environment

Windows 10
macOS Catalina

Activity

Show:
Michael Suhr
September 28, 2020, 2:27 PM

add sample to github

Guillaume Smet
September 28, 2020, 3:21 PM

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.

Gunnar Morling
September 28, 2020, 3:30 PM

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.

Michael Suhr
September 28, 2020, 3:40 PM
Edited

On first test it work with -XX:+UnlockDiagnosticVMOptions -XX:+ExpandSubTypeCheckAtParseTime

Guillaume Smet
September 29, 2020, 8:29 AM

We confirmed it's a JDK issue. I'm closing this one.

Thanks for reporting!

Assignee

Unassigned

Reporter

Michael Suhr

Labels

None

Feedback Requested

None

Feedback Requested By

None

backPortable

None

Suitable for new contributors

None

Pull Request

None

backportDecision

None

backportReEvaluate

None

Components

Affects versions

Priority

Major
Configure