@SuppressWarnings("unchecked")
    protected Q newInstance(Class<Q> queryType, PathMetadata pm) {
        try {
            if (constructor == null) {
                if (Constants.isTyped(queryType)) {
                    try {
                        constructor = queryType.getDeclaredConstructor(Class.class, PathMetadata.class, PathInits.class);
                        usePathInits = true;
                    } catch (NoSuchMethodException e) {
                        constructor = queryType.getDeclaredConstructor(Class.class, PathMetadata.class);
                    }
                } else {
                    try {
                        constructor = queryType.getDeclaredConstructor(PathMetadata.class, PathInits.class);
                        usePathInits = true;
                    } catch (NoSuchMethodException e) {
                        constructor = queryType.getDeclaredConstructor(PathMetadata.class);
                    }
                }
                constructor.setAccessible(true);
            }
            if (Constants.isTyped(queryType)) {
                if (usePathInits) {
                    return (Q) constructor.newInstance(getElementType(), pm, inits);
                } else {
                    return (Q) constructor.newInstance(getElementType(), pm);
                }

            } else {
                if (usePathInits) {
                    return (Q) constructor.newInstance(pm, inits);
                } else {
                    return (Q) constructor.newInstance(pm);
                }
            }
        } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException | InstantiationException e) {
            throw new ExpressionException(e);
        }

    }
Create a path that matches any element in this collection

@return path expression
querydsl-core/src/main/java/com/querydsl/core/types/dsl/CollectionPathBase.java