private static Type unwrap(Type type) {
        if (type instanceof EntityType) {
            return ((EntityType) type).getInnerType();
        } else {
            return type;
        }
    }
Resolve type declared in declaringType for context

@param type type to be resolved
@param declaringType declaration context of type
@param context target context of type
@return resolved type
querydsl-codegen/src/main/java/com/querydsl/codegen/TypeResolver.java