Changes Query#getConcreteTypes to exclude class-less types if the query was initialized with a class to prevent ClassCastException.