Wolfgang Seifert (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=635f717...
) *created* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiN2QxZjc0MDgw...
) / Bug (
https://hibernate.atlassian.net/browse/HHH-15646?atlOrigin=eyJpIjoiN2QxZj...
) HHH-15646 (
https://hibernate.atlassian.net/browse/HHH-15646?atlOrigin=eyJpIjoiN2QxZj...
) Using a generic DTO i get a ClassCastException: class
sun.reflect.generics.reflectiveObjects.TypeVariableImpl cannot be cast to class
java.lang.reflect.ParameterizedType (
https://hibernate.atlassian.net/browse/HHH-15646?atlOrigin=eyJpIjoiN2QxZj...
)
Issue Type: Bug Affects Versions: 6.1.5 Assignee: Unassigned Components: hibernate-core
Created: 31/Oct/2022 00:24 AM Environment: hibernate 6.1.5 orm / core gradlew test
Priority: Major Reporter: Wolfgang Seifert (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=635f717...
)
I was able to reproduce the bug using hibernates own test classes:
In org/hibernate/orm/test/sql/exec/SmokeTests.java replace
public static class BasicSetterBasedDto {
private String code;
private String value;
public String getCode() {
return code;
}
public void setCode( String code) {
this.code = code;
}
public String getValue() {
return value;
}
public void setValue( String value) {
this.value = value;
}
}
with
public static class BasicSetterBasedDto<T> {
private T code;
private T value;
public BasicSetterBasedDto() {
}
public BasicSetterBasedDto(T code, T value) {
this.code = code;
this.value = value;
}
public T getCode() {
return code;
}
public void setCode(T code) {
this.code = code;
}
public T getValue() {
return value;
}
public void setValue(T value) {
this.value = value;
}
}
and one test will fail with:
java.lang.ClassCastException: class
sun.reflect.generics.reflectiveObjects.TypeVariableImpl cannot be cast to class
java.lang.reflect.ParameterizedType
(sun.reflect.generics.reflectiveObjects.TypeVariableImpl and
java.lang.reflect.ParameterizedType are in module java.base of loader
'bootstrap')
Removing the constructors avoids the problem.
(
https://hibernate.atlassian.net/browse/HHH-15646#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-15646#add-comment?atlOrigin=ey...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100209- sha1:5956172 )