code: public static Key<?> getProvidedKey(Key<?> key) {
      Type providerType = key.getTypeLiteral().getType();
  
      // If the Provider has no type parameter (raw Provider)...
      Preconditions.checkArgument(providerType instanceof ParameterizedType,
          "Expected all providers to be parameterized, but %s wasn't", key);
  
      Type entryType = ((ParameterizedType) providerType).getActualTypeArguments()[0];
  
      return key.ofType(entryType);
    }
docs: Given a parameterized type (such as a {@code Provider<Foo>}) return the
  parameter ({@code Foo}).