public class Utl { // --- simple public static interface F1Itf extends Comparable { int getSize(); T getField(); } // --- nested typed-generic public static interface F2Itf extends Comparable> { int getSize(); T getField(); } // --- Comparable // Sun: ERROR // Eclipse: ERROR public static > int cmp1(final T t1, final T t2) { return t1.compareTo(t2); } // Sun: OK // Eclipse: OK public static > int cmp2(final T t1, final T t2) { return t1.compareTo(t2); } // --- F1Itf // Sun: ERROR // Eclipse: ERROR public static > int cmp3(final T t1, final T t2) { return t1.compareTo(t2); } // Sun: OK // Eclipse: OK public static > int cmp4(final T t1, final T t2) { return t1.compareTo(t2); } // --- F2Itf // Sun: ERROR // Eclipse: OK -> wildcard in F2Itf public static > int cmp5(final T t1, final T t2) { return t1.compareTo(t2); } // Sun: OK // Eclipse: OK public static > int cmp6(final T t1, final T t2) { return t1.compareTo(t2); } } /* * javac -version: javac 1.6.0_11 * java -version: * java version "1.6.0_11" * Java(TM) SE Runtime Environment (build 1.6.0_11-b03) * Java HotSpot(TM) Client VM (build 11.0-b16, mixed mode, sharing) * * Utl.java:24: compareTo(capture#407 of ?) in java.lang.Comparable cannot be applied to (T) * return t1.compareTo(t2); * ^ * Utl.java:38: compareTo(capture#825 of ?) in java.lang.Comparable cannot be applied to (T) * return t1.compareTo(t2); * ^ * Utl.java:52: compareTo(Utl.F2Itf) in java.lang.Comparable> cannot be applied to (T) * return t1.compareTo(t2); * ^ * 3 errors */