Community
Participate
Working Groups
Eclipse SDK Version: 3.3.0 Build id: I20060922-0010 (3.3M2) In the following example, I was expecting a compiler warning: package com.seagullsw.appinterface.server.backend.ims; public abstract class AbstractA { class A extends AbstractA { public void callMe() { } } public abstract void callMe(); class B { public void callSite() { // expect warning not there: ((A) this.getAA()).callMe(); Integer max = new Integer(1); // execpted warning there: Integer other = (Integer) max; } public AbstractA getAA() { return null; } } }
We do not issue unnecessary cast warnings on receiver, since the actual receiver type is dumped into the classfile when invoking #callMe(). So removing the cast may alter the generated bytecodes, and we did not want to encourage this by emitting a warning. So removing the cast will change your bytecode from: invoke A#callMe() to invoke AbstractA#callMe() which may be equivalent presently, but may behave differently once dealing with binary compatibility (in rare conditions). No action planned
Added CastTest#test041