|
This looks like a bug in IBM JDK. When introspecting a generic parameter of a method using getAnnotatedParameterTypes, IBM JDK returns an instance of sun.reflect.annotation.AnnotatedTypeFactory$AnnotatedTypeBaseImpl instead of the correct sun.reflect.annotation.AnnotatedTypeFactory$AnnotatedParameterizedTypeImpl When introspecting generic fields or methods' return values this way, it works correctly!
The impact is that Hibernate Validator won't see nor be able to enforce constraints which are declared using type-use annotations on method parameters.
This also causes 8 failures in Hibernate Validator test suite when running with IBM JDK 8 - 4 in OptionalTypeAnnotationConstraintOnMethodTest and 4 in OptionalTypeAnnotationConstraintOnConstructorTest
Reproducer - simply compile this and run it using IBM JDK - it will fail with a ClassCastException, while it will finish successfully on other JDKs:
Btw. To be able to run the Hibernate Validator test suite using IBM JDK, you also need to get rid of classes which depend on JavaFX and turn off the maven-enforcer-plugin using -Denforcer.skip=true..
|