private static AnnotatedTypeMirror asOuterSuper(Types types,AnnotatedTypeFactory atypeFactory,AnnotatedTypeMirror type,AnnotatedTypeMirror superType){
  if (type.getKind() == TypeKind.DECLARED) {
    AnnotatedDeclaredType dt=(AnnotatedDeclaredType)type;
    AnnotatedDeclaredType enclosingType=dt;
    TypeMirror superTypeMirror=types.erasure(superType.getUnderlyingType());
    while (enclosingType != null) {
      TypeMirror enclosingTypeMirror=types.erasure(enclosingType.getUnderlyingType());
      if (types.isSubtype(enclosingTypeMirror,superTypeMirror)) {
        dt=enclosingType;
        break;
      }
      enclosingType=enclosingType.getEnclosingType();
    }
    if (enclosingType == null) {
      return superType;
    }
    return asSuper(atypeFactory,dt,superType);
  }
  return asSuper(atypeFactory,type,superType);
}

private static AnnotatedTypeMirror asOuterSuper ( Types types , AnnotatedTypeFactory atypeFactory , AnnotatedTypeMirror type , AnnotatedTypeMirror superType ) { if ( type . getKind ( ) == TypeKind . DECLARED ) { AnnotatedDeclaredType dt = ( AnnotatedDeclaredType ) type ; AnnotatedDeclaredType enclosingType = dt ; TypeMirror superTypeMirror = types . erasure ( superType . getUnderlyingType ( ) ) ; while ( enclosingType != null ) { TypeMirror enclosingTypeMirror = types . erasure ( enclosingType . getUnderlyingType ( ) ) ; if ( types . isSubtype ( enclosingTypeMirror , superTypeMirror ) ) { dt = enclosingType ; break ; } enclosingType = enclosingType . getEnclosingType ( ) ; } if ( enclosingType == null ) { return superType ; } return asSuper ( atypeFactory , dt , superType ) ; } return asSuper ( atypeFactory , type , superType ) ; }
return the base type of type or any of its outer types that starts with the given type . if none exists , return null .
