code: public static Map<String, Type> extractOwnerGenerics(final Class<?> type,
                                                           final Map<String, Type> generics) {
          final boolean hasOwnerGenerics =
                  type.isMemberClass() && type.getTypeParameters().length != generics.size();
          if (!hasOwnerGenerics) {
              return Collections.emptyMap();
          }
          final LinkedHashMap<String, Type> res = new LinkedHashMap<String, Type>(generics);
          // owner generics are all generics not mentioned in signature
          for (TypeVariable var : type.getTypeParameters()) {
              res.remove(var.getName());
          }
          return res;
      }
docs: It is important to keep possible outer class generics, because they may be used in type declarations.
  NOTE: It may be not all generics of owner type, but only visible owner generics.
  <pre>{@code class Outer<T, K> {
  // outer generic T hidden
  class Inner<T> {}
  }}</pre>
  In order to recover possibly missed outer generics use {@code extractTypeGenerics(type, resultedMap)}
  (may be required for proper owner type to string printing with all generics).
  
  @param type     type
  @param generics all type's context generics (self + outer class)
  @return owner class generics if type is inner class or empty map if not