javac 8 with target level 7

Anna Kozlova anna.kozlova at jetbrains.com
Tue Dec 17 08:38:51 PST 2013


Hi,

The code compiles with java 8 (b. 119) target 7, but fails to compile with
javac 7 target 7:

import java.util.Comparator;

class GenericMethod {
    <E extends Comparable<E>> Comparator<E> getComparator() {
        return null;
    }

    <E> void useComparator(Comparator<? super E> comparator) {
    }

    void test() {
        useComparator(this.getComparator());
    }
}

Was that intended?

Thanks,
Anna



More information about the lambda-dev mailing list