code: public static boolean isInstance(Type a, Type b) {
      if (a instanceof Class<?>) {
        return a.equals(b);
      } else if (a instanceof GenericArrayType) {
        if (b instanceof GenericArrayType) {
          return isInstance(
              ((GenericArrayType) a).getGenericComponentType(),
              ((GenericArrayType) b).getGenericComponentType());
        } else {
          return false;
        }
      } else if (a instanceof ParameterizedType) {
        if (!(b instanceof ParameterizedType)) {
          return false;
        }
        ParameterizedType parameterizedTypeA = (ParameterizedType) a;
        ParameterizedType parameterizedTypeB = (ParameterizedType) b;
        Type[] actualTypeArgumentsA = parameterizedTypeA.getActualTypeArguments();
        Type[] actualTypeArgumentsB = parameterizedTypeB.getActualTypeArguments();
        if (!parameterizedTypeA.getRawType().equals(parameterizedTypeB.getRawType()) ||
            actualTypeArgumentsA.length != actualTypeArgumentsB.length) {
          return false;
        }
        for (int i = 0; i < actualTypeArgumentsA.length; i++) {
          if (!isInstance(actualTypeArgumentsA[i], actualTypeArgumentsB[i])) {
            return false;
          }
        }
        return true;
      } else if (a instanceof TypeVariable<?>) {
        TypeVariable<?> typeVariable = (TypeVariable<?>) a;
        for (Type bound : typeVariable.getBounds()) {
          return isAssignableFrom(bound, b);
        }
        return true;
      } else if (a instanceof WildcardType) {
        WildcardType wildcardType = (WildcardType) a;
        for (Type lowerBound : wildcardType.getLowerBounds()) {
          if (!isAssignableFrom(b, lowerBound)) {
            return false;
          }
        }
        for (Type upperBound : wildcardType.getUpperBounds()) {
          if (!isAssignableFrom(upperBound, b)) {
            return false;
          }
        }
        return true;
      }
      throw new IllegalStateException();
    }
docs: Verifies that {@code b} is an instance of the type scheme {@code a}.