Skip to content

Endless Loop in EntityContainer #4

Description

@MeFisto94

It might be due to my special setup: I have something like class B extends A<Spatial>, whereas class A<T> extends EntityContainer<T>

The code in question is right in the constructor of the EntityContainer:

// Find out what the type parameter is       
        for( Type t = getClass().getGenericSuperclass(); t != null; ) {
            if( t instanceof ParameterizedType ) {
                ParameterizedType pt = (ParameterizedType)t;
                if( pt.getRawType() == EntityContainer.class ) {
                    parameter = (Class)pt.getActualTypeArguments()[0];
                    break;
                } 
            } else if( t instanceof Class ) {
                t = ((Class)t).getGenericSuperclass();
            } else {            
                t = null;
            }
        }

In my case t is instanceof ParameterizedType, but the RawType isn't EntityContainer.

I could get around this by adding t = ((Class)pt.getRawType()).getGenericSuperclass(); just before the first else-if, however that leads to a Cast Exception in parameter = .

For some reason, the rawType now is EntityContainer, however the ActualTypeArgument still is ParameterizedTypeImpl of class A<T>

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions