asInstanceOf2 abstract method

  1. @experimental
InterfaceType? asInstanceOf2(
  1. InterfaceElement2 element
)

Return the canonical interface that this type implements for element, or null if such an interface does not exist.

For example, given the following definitions

class A<E> {}
class B<E> implements A<E> {}
class C implements A<String> {}

Asking the type B<int> for the type associated with A will return the type A<int>. Asking the type C for the type associated with A will return the type A<String>.

For a TypeParameterType with a bound (declared or promoted), returns the interface implemented by the bound.

Implementation

@experimental
InterfaceType? asInstanceOf2(InterfaceElement2 element);