Skip to content

Instantly share code, notes, and snippets.

@terabyte
Created February 5, 2016 20:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save terabyte/9df95bdd3eabe2246c0c to your computer and use it in GitHub Desktop.
Save terabyte/9df95bdd3eabe2246c0c to your computer and use it in GitHub Desktop.
import java.util.ArrayList;
class A {
interface Function<B, C> {
C apply(B input);
}
private <B,C> Iterable<C> transform(Iterable<B> iterable, Function<? super B, ? extends C> transform) {
// impl not relevant for bug
return new ArrayList<>();
}
public static class In<V> {}
public static class Out<V> {}
public <V> Out<V> fn(In<V> in) {
return null;
}
public void myMethod() {
Iterable<In<?>> ins = new ArrayList<>();
Iterable<Out<?>> outs = transform(ins, this::fn);
}
}
@terabyte
Copy link
Author

terabyte commented Feb 5, 2016

Using Sun Java 1.8.0_45:
javac A.java => success

Using ECJ 4.6M5:
java -jar ecj-4.6M5.jar -source 1.8 -target 1.8 A.java => failure

Output:

----------
1. ERROR in /home/cmyers/projects/private_notes/persistent/bugs/20160205-jdk-versus-ecj/A.java (at line 24)
        Iterable<Out<?>> outs = transform(ins, this::fn);
                               ^^^^^^^^^^^^^^^^^^^^^^^^
Type mismatch: cannot convert from Iterable<Object> to Iterable<A.Out<?>>
----------
1 problem (1 error)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment