Community
Participate
Working Groups
Build 3.2m4 Following code should be accepted: public class X { static class C1 { void c1m1() { System.out.println("FISK"); } } static interface I { } static class C2 extends C1 implements I { } static class C3 extends C1 implements I { } public <T> T m1(T t1, T t2) { return null; } public <T extends C1 & I> void test(C2 c2, C3 c3, T t) { m1(c2, c3).c1m1(); // 1 t.c1m1(); // 2 (t != null ? c2 : c3).c1m1(); // 3 } public static void main(String... args) { Test t = new Test(); t.test(new C2(), new C3(), new C2()); // 4 } }
Also see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5073060
Note that field and member types accesses are similarily affected. Added GenericTypeTest#test893. Fixed
Backported to 3.1.x.
Better testcase: public class X { static class C1 { void c1m1() { System.out.print("[c1m1]"); } } static interface I {} static class C2 extends C1 implements I {} static class C3 extends C1 implements I {} public <T> T m1(T t1, T t2) { return t1; } public <T extends C1 & I> void test(C2 c2, C3 c3, T t) { m1(c2, c3).c1m1(); // 1 t.c1m1(); // 2 (t != null ? c2 : c3).c1m1(); // 3 } public static void main(String... args) { X x = new X(); x.test(new C2(), new C3(), new C2()); // 4 System.out.println(); } }
Also added GenericTypeTest#test894
Verified for 3.2 M5 using build I20060215-0010