Summary: | new compiler warning for stuff like Object o = (Integer)(new Object()) | ||
---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Sven Köhler <sven.koehler> |
Component: | Core | Assignee: | Philipe Mulet <philippe_mulet> |
Status: | VERIFIED FIXED | QA Contact: | |
Severity: | enhancement | ||
Priority: | P3 | ||
Version: | 3.0 | ||
Target Milestone: | 3.2 M3 | ||
Hardware: | All | ||
OS: | All | ||
Whiteboard: |
Description
Sven Köhler
2004-07-16 10:36:25 EDT
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 |