Union types

I’m curious if any movement has happened on this topic. In response to @elizarov’s question, the point (or at least the primary use case in my view) is being able to create type-safe APIs using existing patterns and APIs - JSON is just one example where plenty of Java libraries have worked around the lack of union types. Consider org.JSONObject which has several overloads of put:

public JSONObject put(String name, boolean value);
public JSONObject put(String name, double value);
public JSONObject put(String name, double value);
public JSONObject put(String name, int value);
public JSONObject put(String name, long value);
public JSONObject put(String name, Object value);

The last of these overloads is for “throw your hands in the air and hope you have one of those types”. We could do better if we had polymorphic dispatch, which is related to (and can be solved by?) union types. The same can be said for android.os.Bundle and many others - even Anko does this, and it feels like it’s a common enough use case that the language can help with.