class A { private static class Tuple { public final X x; public final Y y; public Tuple(X x,Y y) {this.x=x; this.y=y;} public static Tuple create(X1 x, Y1 y) { return new Tuple(x, y); } } private static class Foo { void f() { Tuple t = Tuple.create("",""); Tuple t2 = Tuple.create((Object) "",(Object) ""); String x = t.x; } } }