I'm trying to code an implementation of type inference, using the algorithm outlined in the Java spec, at https://docs.oracle.com/javase/specs/jls/se8/html/jls-18.html#jls-18.2.3
There is a line here with some implications I'm struggling to understand:
"...among the supertypes of S that are array types, a most specific type is identified, S'[] (this may be S itself)."
How can S itself not be the most specific array type? In other words, how can a type have supertypes which are array types, and not itself be an array type (and therefore of the most specific kind)?
Am I missing something obvious here?
Thanks for any insight anyone can offer...
Say you have a Double[] and the options are Number[] or Object[] then Number[] is the most specific match. When performing type inference, there might be multiple constraints. It might even infer the type (Serializable[] & Comparable[])