Community
Participate
Working Groups
hi, code like LinkedList l = ... Object o = (Integer)l.getFirst(); contains a cast, that is uncessary. What the programmer wanted to write, was either Integer o = (Integer)l.getFirst(); or simply Object o = l.getFirst();
OK, the cast is not unnecessary. It can produce a ClassCastException, but the like Integer o = (Integer)l.getFirst(); seems much better style to me.
That is a separate issue better handle by code reviewing tools. Will keep it for LATER.
Reconsidering. This is similar to what we already do in other cases, like arguments in a method invocation. foo(Object o) invoked with foo((Integer)someObj) // warning for unnecessary cast.
Added support for both assignments and variable (local+field) declarations. Fixed. Tuned existing tests.
Verified for 3.2 M3 using build I20051025-0800+JDT/Core v_618a