code: Type sharpestAccessible(Type originalType) {
          if (originalType.hasTag(ARRAY)) {
              return types.makeArrayType(sharpestAccessible(types.elemtype(originalType)));
          }
  
          Type type = originalType;
          while (!rs.isAccessible(gen.getAttrEnv(), type.asElement())) {
              type = types.supertype(type);
          }
          return type;
      }
docs: If the type is not accessible from current context, try to figure out the
  sharpest accessible supertype.
  
  @param originalType type to sharpen
  @return sharped type