18.2.2 Type Compatibility Constraints 0.7.0 changes

Anna Kozlova anna.kozlova at jetbrains.com
Tue Nov 19 02:20:09 PST 2013


Hi,

 

In 0.7.0 spec "if T is a parameterized type of the form G<T1, ..., Tn>, and
there exists no type of the form G<S1, ..., Sn> that is a supertype of S,
but the raw type G is a supertype of S, then the constraint reduces to true"
was added. How does javac then infer raw substitution here?

 

class Test {

    interface Condition<K> {}

    class SpecialCondition<M> implements Condition {}

 

    static <T> List<T> filter(T[] c, Condition<? super T> con) {

        return null;

    }

 

    void foo(CharSequence[] es, SpecialCondition<CharSequence> con) {

        List<String> l =  filter(es, con);

    }

}

 

Thanks,

Anna



More information about the lambda-dev mailing list