[hibernate-issues] [Hibernate-JIRA] Resolved: (HHH-5068) Fix for AttributeFactory class to manage ParameterizedType

Gail Badner (JIRA) noreply at atlassian.com
Tue Apr 20 18:11:20 EDT 2010


     [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-5068?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gail Badner resolved HHH-5068.
------------------------------

      Assignee: Gail Badner
    Resolution: Duplicate

> Fix for AttributeFactory class to manage ParameterizedType
> ----------------------------------------------------------
>
>                 Key: HHH-5068
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5068
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: entity-manager
>    Affects Versions: 3.5.0-Final
>            Reporter: Romain Rossi
>            Assignee: Gail Badner
>
> To make org.hibernate.ejb.metamodel.AttributeFactory.PluralAttributeMetadataImpl.getClassFromGenericArgument(Type) works after migrating from 3.3.2.GA to 3.5.0-Final. I have to change the method whith:
> private Class<?> getClassFromGenericArgument(java.lang.reflect.Type type) {
> 	Class<?> javaType;
> 	Object unsafeElementType = type;
> 	if ( unsafeElementType instanceof Class ) {
> 		javaType = (Class) unsafeElementType;
> 	}
> 	else if ( unsafeElementType instanceof TypeVariable ) {
> 		final java.lang.reflect.Type upperBound = ( ( TypeVariable ) unsafeElementType ).getBounds()[0];
> 		javaType = getClassFromGenericArgument( upperBound );
> 	}
>         // ADDED TO FIX THE ParameterizedType
> 	else if ( unsafeElementType instanceof ParameterizedType) {
> 		javaType = (Class<?>)((ParameterizedType)type).getRawType();
> 	}
>         // END FIX
> 	else {
> 		throw new AssertionFailure("Fail to process type argument in a generic declaration. Type: "
> 				+ type.getClass() );
> 	}
> 	return javaType;
> }
> Is there an other way to manage the ParameterizedType?

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list