public static TypeMirror upperBound(TypeMirror type){
  do {
    if (type instanceof TypeVariable) {
      TypeVariable tvar=(TypeVariable)type;
      if (tvar.getUpperBound() != null) {
        type=tvar.getUpperBound();
      }
 else {
        break;
      }
    }
 else     if (type instanceof WildcardType) {
      WildcardType wc=(WildcardType)type;
      if (wc.getExtendsBound() != null) {
        type=wc.getExtendsBound();
      }
 else {
        break;
      }
    }
 else {
      break;
    }
  }
 while (true);
  return type;
}

public static TypeMirror upperBound ( TypeMirror type ) { do { if ( type instanceof TypeVariable ) { TypeVariable tvar = ( TypeVariable ) type ; if ( tvar . getUpperBound ( ) != null ) { type = tvar . getUpperBound ( ) ; } else { break ; } } else if ( type instanceof WildcardType ) { WildcardType wc = ( WildcardType ) type ; if ( wc . getExtendsBound ( ) != null ) { type = wc . getExtendsBound ( ) ; } else { break ; } } else { break ; } } while ( true ) ; return type ; }
if the argument is a bounded typevariable or wildcardtype , return its non - variable , non - wildcard upper bound . otherwise , return the type itself .
