New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ClassCastException in TypeResolver (ResolvedRecursiveType cannot be cast to ResolvedObjectType) #16
Comments
Ok this seems possible theoretically (and given that you hit it, now in practice...). But while fix may be simple to do (cast may not be necessary) I would need a test case to verify that the problem would be completely resolved. Would it be possible to get a code snippet or test to reproduce this problem? |
I'm not using the classmate library directly, so it's difficult for me to create a testcase. I tried to create a simple Maven project with hibernate-maven-plugin that reproduces the issue but didn't succeed yet. |
Ok. I hope we can eventually reproduce it, so that it will be possible to come up with fix & verification. |
We're also seeing this error when trying to update from Hibernate Validator 4.3.1 to 5.1.2. The following test will reproduce the error: public static void main(String[] args) {
TypeResolver resolver = new TypeResolver();
resolver.resolve(Bar.class);
}
private static class Foo extends Bar { }
private static class Bar extends Zen<Bar, Foo> { }
private static class Zen<A, B extends A> { } |
@cheister thank you. That certainly is simple enough to reproduce. |
Fixed, will be in 1.1.0 release which is being released at this point. |
Thanks for the quick turnaround on the fix! |
No problem, thank you for providing the test. For a while I worried it might be complicated thing to fix, but in the end things worked out reasonably well I think. 1.1.0 should be available from Maven Central now. |
I'm using hibernate validator for bean validation. During the ddl generation a ClassCastException is thrown:
java.lang.ClassCastException: com.fasterxml.classmate.types.ResolvedRecursiveType cannot be cast to com.fasterxml.classmate.types.ResolvedObjectType
at com.fasterxml.classmate.TypeResolver._resolveSuperClass(TypeResolver.java:422)
at com.fasterxml.classmate.TypeResolver._constructType(TypeResolver.java:395)
at com.fasterxml.classmate.TypeResolver._fromClass(TypeResolver.java:351)
at com.fasterxml.classmate.TypeResolver._fromAny(TypeResolver.java:299)
at com.fasterxml.classmate.TypeResolver._fromParamType(TypeResolver.java:437)
at com.fasterxml.classmate.TypeResolver._fromAny(TypeResolver.java:305)
at com.fasterxml.classmate.TypeResolver._resolveSuperInterfaces(TypeResolver.java:409)
at com.fasterxml.classmate.TypeResolver._constructType(TypeResolver.java:395)
at com.fasterxml.classmate.TypeResolver._fromClass(TypeResolver.java:351)
at com.fasterxml.classmate.TypeResolver.resolve(TypeResolver.java:111)
at org.hibernate.validator.internal.util.ReflectionHelper.parametersResolveToSameTypes(ReflectionHelper.java:755)
The text was updated successfully, but these errors were encountered: