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

Romain Rossi (JIRA) noreply at atlassian.com
Sun Apr 4 08:08:31 EDT 2010


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


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