Community
Participate
Working Groups
List list = (List)new ArrayList();
Created attachment 9172 [details] Interface cast detection There were at least two places both dealing with casting to an interface which were not detecting unnecessary casts. Is it necessary to perform the runtime checkcast when you know that the two types are compatible? In one case, I left the checkcast in and the other I removed it since I wasn't sure which was correct. But overall I think the idea is correct.
Thanks for investigating Michael, you were on the right track. Our casting check was not correct; and we issued more checkcast instructions than we should have in this case. Fixed both class->interface and interface->interface scenario, and instanceof + equal expression checks. Added regression test: CastTest#test033.
Fix implemented in both HEAD and JDK_1_5 streams.
Verified in 200405180816