new inference: initial tests

This commit is contained in:
Anna Kozlova
2013-09-20 12:11:57 +04:00
parent 970a180902
commit 935cdbaf3b
229 changed files with 7713 additions and 1 deletions
@@ -0,0 +1,22 @@
class TestClass {
public final class TestMapper<X> {
public <U, T extends Mapping<X, U>> T mapType() {
SimpleMapping<X, U> mapping = new SimpleMapping<X, U>();
return (T) mapping; //This is reports "Inconvertible types; cannot cast TestClass.SimpleMapping<X,U> to 'T'"
}
}
private final class SimpleMapping<X, U> implements Mapping<X, U> {}
public interface Mapping<F, U> {}
}
class TestClass1 {
public final class TestMapper<X> {
public <U, T extends Mapping<X, U>> T mapType() {
Mapping<X, U> mapping = new SimpleMapping<X, U>(); //Changed type to interface
return (T) mapping;
}
}
private final class SimpleMapping<X, U> implements Mapping<X, U> {}
public interface Mapping<F, U> {}
}