can lead to classcastexception in case it is not a map of dataobjects
766046
public Iterable<Tuple2<String, Obj>> asKeyObjSeq(final @Nullable Obj obj) {
		return new Iterable<Tuple2<String, Obj>>() {
			@Override public Iterator<Tuple2<String, Obj>> iterator() {
				if (obj != null) {
					final Iterator<Entry<String, Object>> i = obj.iterator();
					return new Iterator<Tuple2<String, Obj>>() {
						@Override public boolean hasNext() {
							return i.hasNext();
						}
						@Override public Tuple2<String, Obj> next() {
							Entry<String, Object> entry = i.next();
							return new Tuple2<String, Obj>(entry.getKey(), (Obj) entry.getValue());
						}
						@Override public void remove() {
							Check.unsupportedoperation.fail();
						}
					};
				}
				return java.util.Collections.emptyIterator();
			}
		};
	}
949325
private void readObject (ObjectInputStream s)
         throws IOException, ClassNotFoundException
    {
        // read in number of buckets and allocate the bucket array
        _buckets = createBuckets(s.readInt());
        _loadFactor = s.readFloat();

        // read in size (number of mappings)
        int size = s.readInt();

        // read the keys and values
        for (int i=0; i<size; i++) {
            int key = s.readInt();
            @SuppressWarnings("unchecked") V value = (V)s.readObject();
            put(key, value);
        }
    }
435597
@SuppressWarnings({ "unchecked", "rawtypes" })
	public static final <TO, FROM> TO convert(Class<TO> to, FROM from) {

		// Convert null value
		if (from == null || to == null) {
			return null;
		}

		// Convert "null" String to null
		if ("null".equals(from)) {
			return null;
		}

		// Class is same
		if (to == Object.class || from.getClass() == to) {
			return (TO) from;
		}

		// BSON conversion
		boolean isFromMap = from != null && from instanceof Map;
		if (isFromMap) {
			Object subValue = getSubValue((Map) from);
			if (subValue != null) {
				return convert(to, subValue);
			}
		}

		// Convert FROM -> TO
		DataConverterKey<TO, FROM> key = new DataConverterKey<TO, FROM>(to, (Class<FROM>) from.getClass());
		DataConverter<TO, FROM> converter = (DataConverter<TO, FROM>) converters.get(key);
		if (converter != null) {
			return converter.convert(from);
		}

		// Convert any -> TO
		converter = (DataConverter<TO, FROM>) defaultConverters.get(to);
		if (converter != null) {
			return converter.convert(from);
		}

		// Converter not found
		throw new IllegalArgumentException("Unable to convert " + from.getClass() + " to " + to
				+ ", converter not found in DataConverterRegistry!");
	}
63679
private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException
   {
      ObjectInputStream.GetField fields = ois.readFields();
      String name = serialPersistentFields[ID_IDX].getName();
      this.id = fields.get(name, CONNECTION_ERROR_OCCURRED);
      name = serialPersistentFields[EXCEPTION_IDX].getName();
      this.e = (Exception) fields.get(name, null);
      name = serialPersistentFields[CONN_HANDLE_IDX].getName();
      this.connectionHandle = fields.get(name, null);
   }
1131880
private void readObject(ObjectInputStream in) throws ClassNotFoundException, NoSuchMethodException, IOException {
        result = ClassRef.read(in);
        arg = ClassRef.read(in);
        name = in.readUTF();
    }
678844
public static boolean shouldAutoCastTo(PrimitiveType from, PrimitiveType to) {
		InternalType[] castTypes = POSSIBLE_CAST_MAP.get(from);
		if (castTypes != null) {
			for (InternalType type : POSSIBLE_CAST_MAP.get(from)) {
				if (type.equals(to)) {
					return true;
				}
			}
		}
		return false;
	}
1367774
private void checkIsCastableToDefinedType(Option o, Map<String, String> data) throws RequiredParametersException {
		if (o.hasType() && !o.isCastableToDefinedType(data.get(o.getName()))) {
			throw new RequiredParametersException("Value for parameter " + o.getName() +
					" cannot be cast to type " + o.getType());
		}
	}
1351491
@SuppressWarnings("unchecked")
    @Trivial
    private JSONObject toJSONObjectForThrowable(Map<String, ?> errorInfo, Throwable error) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
            Tr.debug(this, tc, "toJSONObjectForThrowable", errorInfo, error);

        LinkedHashMap<String, List<?>> addedInfo = new LinkedHashMap<String, List<?>>();
        for (Map.Entry<String, ?> entry : errorInfo.entrySet()) {
            Object value = entry.getValue();
            if (value instanceof List)
                addedInfo.put(entry.getKey(), (List<?>) value);
        }

        JSONObject json = new OrderedJSONObject();

        int index = 0;
        JSONObject current = json;
        Set<Throwable> causes = new HashSet<Throwable>(); // avoid cycles in exception chain
        for (Throwable cause = error; cause != null && causes.add(cause); index++) {
            // custom attributes for position in exception chain (for example, sqlState and errorCode for dataSource)
            for (Map.Entry<String, List<?>> entry : addedInfo.entrySet()) {
                List<?> values = entry.getValue();
                if (values.size() > index) {
                    Object value = values.get(index);
                    if (value != null)
                        current.put(entry.getKey(), value);
                }
            }

            current.put("class", cause.getClass().getName());
            current.put("message", cause.getMessage());

            JSONArray stack = new JSONArray();
            for (StackTraceElement element : cause.getStackTrace())
                stack.add(element.toString());
            current.put("stack", stack);

            if ((cause = cause.getCause()) != null) {
                Map<String, Object> parent = current;
                parent.put("cause", current = new OrderedJSONObject());
            }
        }

        return json;
    }
1307463
private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
    in.defaultReadObject();

    try {
      serialization = serializationClass.newInstance();
    } catch (IllegalAccessException | InstantiationException e) {
      throw new RuntimeException(
          "Failed to deserialize " + HadoopSerializationCoder.class.getSimpleName());
    }
  }
96167
private void checkException(DataInputStream inputStream) throws IOException {
        short retCode = inputStream.readShort();
        if(retCode != 0) {
            String error = inputStream.readUTF();
            throw mapper.getError(retCode, error);
        }
    }
947868
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException {
        jsonObject = Utils.mapper().readValue((DataInput) stream, ObjectNode.class);
    }
196150
@Override
    public Object getObject(String parameterName, Map<String,Class<?>> map) throws SQLException
    {
        checkClosed();
        throw SQLError.noSupport();
    }
539021
@NonNull
    @Override
    public From from(@NonNull DataSource dataSource) {
        if (dataSource == null) {
            throw new IllegalArgumentException("dataSource cannot be null.");
        }
        return new From(this, dataSource);
    }
1014604
@SuppressWarnings("unchecked")
    public static <T> T castToType(final Class<T> type, final Object val) throws DevFailed {

	T result;
	if (val == null) {
	    result = null;
	} else if (type.isAssignableFrom(val.getClass())) {
	    result = (T) val;
	} else {
	    LOGGER.debug("converting {} to {}", val.getClass().getCanonicalName(), type.getCanonicalName());
	    // if input is not an array and we want to convert it to an array.
	    // Put
	    // the value in an array
	    Object array = val;
	    if (!val.getClass().isArray() && type.isArray()) {
		array = Array.newInstance(val.getClass(), 1);
		Array.set(array, 0, val);
	    }
	    final Transmorph transmorph = new Transmorph(creatConv());
	    try {
		result = transmorph.convert(array, type);
	    } catch (final ConverterException e) {
		LOGGER.error("convertion error", e);
		throw DevFailedUtils.newDevFailed(e);
	    }
	}
	return result;
    }
1329072
private void _processMetadata(HashMap<String, Object> result) {
		// the collections in the result can be either an object[] or a HashSet<object>, depending on the serializer that is used
		Object methods = result.get("methods");
		Object attrs = result.get("attrs");
		Object oneways = result.get("oneways");

		if(methods instanceof Object[]) {
			Object[] methods_array = (Object[]) methods;
			this.pyroMethods = new HashSet<String>();
			for(int i=0; i<methods_array.length; ++i) {
				this.pyroMethods.add((String) methods_array[i]);
			}
		} else if(methods!=null) {
			this.pyroMethods = getSetOfStrings(methods);
		}
		if(attrs instanceof Object[]) {
			Object[] attrs_array = (Object[]) attrs;
			this.pyroAttrs = new HashSet<String>();
			for(int i=0; i<attrs_array.length; ++i) {
				this.pyroAttrs.add((String) attrs_array[i]);
			}
		} else if(attrs!=null) {
			this.pyroAttrs = getSetOfStrings(attrs);
		}
		if(oneways instanceof Object[]) {
			Object[] oneways_array = (Object[]) oneways;
			this.pyroOneway = new HashSet<String>();
			for(int i=0; i<oneways_array.length; ++i) {
				this.pyroOneway.add((String) oneways_array[i]);
			}
		} else if(oneways!=null) {
			this.pyroOneway = getSetOfStrings(oneways);
		}

		if(pyroMethods.isEmpty() && pyroAttrs.isEmpty()) {
			throw new PyroException("remote object doesn't expose any methods or attributes");
		}
	}
667605
public function mapObjects()
    {
        if ($this->mapObjects === null) {
            $objType = $this->objType();
            if (!$objType) {
                throw new UnexpectedValueException(sprintf(
                    '%1$s cannot create collection map. Object type is not defined.',
                    get_class($this)
                ));
            }

            $loader = $this->collectionLoader();
            $loader->setModel($this->proto());

            $collectionConfig = $this->collectionConfig();
            if (is_array($collectionConfig) && !empty($collectionConfig)) {
                unset($collectionConfig['properties']);
                $loader->setData($collectionConfig);
            }

            $callback = function(&$obj) {
                $obj->mapInfoboxTemplate = $this->infoboxTemplate();

                if ($this->latProperty() && $this->latProperty()) {
                    $obj->mapShowMarker = true;
                    $obj->mapLat = $this->getPropertyValue($obj, $this->latProperty());
                    $obj->mapLon = $this->getPropertyValue($obj, $this->lonProperty());

                    if (!$obj->mapLat || !$obj->mapLon) {
                        $obj = null;
                    }
                } else {
                    $obj->mapShowMarker = false;
                }

                if ($this->pathProperty()) {
                    $mapPath = $this->getPropertyValue($obj, $this->pathProperty());
                    if ($mapPath) {
                        $obj->mapShowPath = true;
                        // Same type of coords.
                        $obj->mapPath = $this->formatPolygon($mapPath);

                        if (!$obj->mapPath) {
                            $obj = null;
                        }
                    } else {
                        $obj->mapShowPath = false;
                    }
                }

                if ($this->polygonProperty()) {
                    $mapPolygon = $this->getPropertyValue($obj, $this->polygonProperty());
                    if ($mapPolygon) {
                        $obj->mapShowPolygon = true;
                        $obj->mapPolygon = $this->formatPolygon($mapPolygon);

                        if (!$obj->mapPolygon) {
                            $obj = null;
                        }
                    } else {
                        $obj->mapShowPolygon = false;
                    }
                }
            };

            $loader->setCallback($callback->bindTo($this));

            $this->mapObjects = $loader->load();
        }

        foreach ($this->mapObjects as $obj) {
            $GLOBALS['widget_template'] = $obj->mapInfoboxTemplate;
            yield $obj;
            $GLOBALS['widget_template'] = '';
        }
    }
901512
private void readObject (ObjectInputStream s)
         throws IOException, ClassNotFoundException
    {
        // read in number of buckets and allocate the bucket array
        _buckets = new Record[s.readInt()];
        _loadFactor = s.readFloat();

        // read in size (number of mappings)
        int size = s.readInt();

        // read the keys and values
        for (int i=0; i<size; i++) {
            put(s.readInt(), s.readInt());
        }
    }