arrays and raw types in 18.2.3

Stephan Herrmann stephan.herrmann at
Tue Oct 8 13:06:01 PDT 2013

Maybe I'm slow today but the following phrase doesn't speak to me:

  o If T is an array type, T'[], then let S'[] be the most specific array type that is a supertype of S (or S itself)

What reasons exist why S'[] would be different from S?
If S is an array type, then S'[] = S.
If S is not an array type,
how can S have an array type as a supertype?

Secondly, how should this constraint be reduced:
   C <: C<α>
According to 18.2.3 I need a parameterization of C
that is a supertype of C (raw).
Since no such supertype exists,
some invocations of generic methods with raw arguments
seem to be illegal now, which were legal in Java 7.

I'm currently looking at this test:

public class X {
   public static void main(String[] args) {
     EntityKey entityKey = null;
     new EntityCondenser().condense(entityKey);
   public static class EntityCondenser {
     <I, E extends EntityType<I, E, K>, K extends EntityKey<I>> void condense(K entityKey) {
   public class EntityKey<I> {}
   public interface EntityType<
     E extends EntityType<I, E, K>,
     K extends EntityKey<I>> {

With my current understanding of 18.2.3 we cannot find
a valid instantiation for K given the argument of raw type EntityKey.
Even seeing sect. 18.5.5 (Unchecked Conversion Inference)
I don't see how this how this can be leveraged from 18.2.3.


More information about the lambda-spec-experts mailing list