Retrieves the type arguments of a class when regarded as an subclass of the
given typed superclass or interface. The order of the runtime type classes matches the order
of the type variables in the declaration of the typed superclass or interface.
For example, for the classes
class Foo<U, V> {}
class Bar<W> extends Foo<String, W> {}
class Baz extends Bar<Long>
and a
typedClass argument of
Baz.class, the method should return
[String, Long] for a typedSuperclass argument of Foo.class,
and
[Long] if typedSuperclass is Bar.class.
For type parameters that cannot be determined,
null is returned.
Note: It is
not possible to retrieve type information that is not available
in the (super)class hierarchy at
compile-time. Calling
getActualTypeArguments(new ArrayList<String>().getClass(), List.class) will,
for instance, return
[null] because the specification of the actual type
(
String, in this example) did not take place either in the superclass
AbstractList
or the interface
List.
If
superclass is
not a superclass or -interface of
class,
the method returns
null. This may happen (in spite of the signature) if the
method is called with non-generic arguments.