Community
Participate
Working Groups
latest 1_5 for 07/16 class A{ void foo(){ List<Integer> li= new ArrayList<Integer>(); List<? extends Number> ls= li; List<Number> x2= (List<Number>)ls;//unsafe x2.add(new Float(1.0)); Integer i= li.get(0);//ClassCastException! } } the line marked //unsafe is indeed unsafe because the assignment 2 lines below throws a CCE
Tuned unsafe cast diagnosis to flag wildcard conversions as well. Added regression test: GenericTypeTest#test253 Fixed.