docs: public static Type getCanonicalType(Class<?> clazz) {
          if (clazz.isArray()) {
              Class<?> componentType = clazz.getComponentType();
              Type resolvedComponentType = getCanonicalType(componentType);
              if (componentType != resolvedComponentType) {
                  // identity check intentional
                  // a different identity means that we actually replaced the component Class with a ParameterizedType
                  return new GenericArrayTypeImpl(resolvedComponentType);
              }
          }
          if (clazz.getTypeParameters().length > 0) {
              Type[] actualTypeParameters = clazz.getTypeParameters();
              return new ParameterizedTypeImpl(clazz, actualTypeParameters, clazz.getDeclaringClass());
          }
          return clazz;
      }