Cool new lint option: redundant casts and feedback
I just d/l b55 and got rid of around 5 unnecessary casts. I now compile using -Xlint.
I managed to get rid of all the unchecked call/conversion in the generics part of my code. There was one thing which got me stumped for a while. I now have to do this in my class, which is kinda weird since I have not used C++ templates since 1997 (and that too was just a cursory reading).
private HashMap > my_map = new HashMap>(4000);
when before the line was
private HashMap my_map = new HashMap(4000);
and was being called like
ArrayList ranges = my_map.get(streetName);
On hindsight, I think it would have really helped if instead of pointing to the exact line of warning i.e add(E) unchecked conversion , javac should also suggest solution in the warning "constructor or initialization of my_map should be >"
Is this too much to ask? javac knows what the problem is at this point. It maybe (may not be?) just a cosmetic improvement, but it would help to go directly to the offending line number and clean it up. Without Angelika Langer's FAQ I would have taken a bit longer to understand what was wrong.