[FB-Discuss] Unchecked/unconfirmed cast (BC_UNCONFIRMED_CAST) inspite of the instanceof

Dave Brosius dbrosius at mebigfatguy.com
Fri Aug 6 06:40:03 EDT 2010


I don't know the answer to your question, but

inputModel *instanceof* MyClass

will check for inputModel != null so that check is redundant.

All you need is

if (inputModel *instanceof* MyClass){

On 08/06/2010 03:59 AM, juhi.a.gupta at accenture.com wrote:
>
> Hi,
>
> I have added the check for instanceof before I cast a reference and 
> still I am getting this warning for Unchecked/unconfirmed cast for the 
> same line.
>
> *if*(inputModel != *null* && inputModel *instanceof* MyClass){
>
> MyClass model = (MyClass)inputModel;
>
> What could be the issue?
>
> Thanks & Best Regards,
> Juhi Gupta
>
> Client Architecture -- Solution Factory, Accenture - IDC, Pune.
>
> https://athenaeum.accenture.com/Java/default.aspx
>
> aol : guptajuhi
>
> Mobile: 09545502627
>
> This message is for the designated recipient only and may contain 
> privileged, proprietary, or otherwise private information. If you have 
> received it in error, please notify the sender immediately and delete 
> the original. Any other use of the email by you is prohibited.
>
>
> _______________________________________________
> Findbugs-discuss mailing list
> Findbugs-discuss at cs.umd.edu
> https://mailman.cs.umd.edu/mailman/listinfo/findbugs-discuss

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cs.umd.edu/pipermail/findbugs-discuss/attachments/20100806/63fa2dae/attachment.html>


More information about the Findbugs-discuss mailing list