code: public static Map<String, Type> extractTypeGenerics(final Class<?> type,
                                                          final Map<String, Type> generics) {
          // assuming generics map always contains correct generics and may include only outer
          // so if we call it with outer type and outer only generics it will correctly detect it
          final boolean enoughGenerics = type.getTypeParameters().length == generics.size();
          if (enoughGenerics) {
              return generics;
          }
          final LinkedHashMap<String, Type> res = new LinkedHashMap<String, Type>();
          // owner generics are all generics not mentioned in signature
          for (TypeVariable var : type.getTypeParameters()) {
              final String name = var.getName();
              if (generics.containsKey(name)) {
                  res.put(name, generics.get(name));
              } else {
                  // case: generic not provided in map may appear with outer class generics, which
                  // may incompletely present in type's generic map (class may use generics with the same name)
                  res.put(name, resolveClass(var.getBounds()[0], res));
              }
          }
          return res;
      }
docs: Generics declaration may contain type's generics together with outer class generics (if type is inner class).
  Return map itself for not inner class (or if no extra generics present in map).
  <p>
  In case when type's generic is not mentioned in map - it will be resolved from variable declaration.
  
  @param type     type
  @param generics all type's context generics (self + outer class)
  @return generics, declared on type ({@code A<T, K> -> T, K}) or empty map if no generics declared on type