In X10 2.3 we intend to do constraint solving at runtime, therefore you could cast:
by checking the runtime type of x, making sure it's a subtype of Array, and the corresponding generic parameter is equal to
However, currently in X10 2.2, the runtime erases all constraints at runtime, so casts of the previous form or even these:
are not sound because:
Therefore the compiler now emits an "Unsound cast" warning on such casts.
These casts are suppressed in XRX because we do not wish the user to receive these warnings, e.g., whenever he uses HashMap.
This warning will be removed when the runtime will store constraints and have constraint solving.