public static boolean containsTypeParameter(Type type){
  if (type.isTypeParameter())   return true;
  for (  Type pt : type.getTypeArgumentList()) {
    if (containsTypeParameter(pt)) {
      return true;
    }
  }
  if (type.isIntersection()) {
    List<Type> types=type.getSatisfiedTypes();
    for (int i=0, l=types.size(); i < l; i++) {
      if (containsTypeParameter(types.get(i)))       return true;
    }
    return false;
  }
  if (type.isUnion()) {
    List<Type> types=type.getCaseTypes();
    for (int i=0, l=types.size(); i < l; i++) {
      if (containsTypeParameter(types.get(i)))       return true;
    }
    return false;
  }
  return false;
}

public static boolean containsTypeParameter ( Type type ) { if ( type . isTypeParameter ( ) ) return true ; for ( Type pt : type . getTypeArgumentList ( ) ) { if ( containsTypeParameter ( pt ) ) { return true ; } } if ( type . isIntersection ( ) ) { List < Type > types = type . getSatisfiedTypes ( ) ; for ( int i = 0 , l = types . size ( ) ; i < l ; i ++ ) { if ( containsTypeParameter ( types . get ( i ) ) ) return true ; } return false ; } if ( type . isUnion ( ) ) { List < Type > types = type . getCaseTypes ( ) ; for ( int i = 0 , l = types . size ( ) ; i < l ; i ++ ) { if ( containsTypeParameter ( types . get ( i ) ) ) return true ; } return false ; } return false ; }
returns true if the given produced type is a type parameter or has type arguments which are type parameters .
