If it throws any RuntimeException then that line will not be executed,
because the exception will make the method exit.

  []'s,

  Rodrigo.

-----Mensagem original-----
De: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Enviada em: sexta-feira, 19 de abril de 2002 16:47
Para: [EMAIL PROTECTED]
Assunto: RE: [Eap-list] #618 Inspection - NPEs



If var = new Class() throws any RuntimeException var will be null.

> In a code like the following:
> 
>   Class var = null;
>   try
>   {
>     if (cond)
>     {
>       var = new Class();
>     }
>     else
>       throw new Exception1();
>   }
>   catch(Exception2 e)
>   {
>     return;
>   }
>   finally
>   {
>     do_something_that_does_not_use_var();
>   }
> 
>   var.method();  <----------
> 
> 
>   In the last line, marked, the inspection says that it may produce a
> NullPointerException. Although I can't see how it can get to 
> that line with
> var being null.
> 
> 
>    []'s,
> 
>    Rodrigo.


_______________________________________________
Eap-list mailing list
[EMAIL PROTECTED]
http://www.intellij.com/mailman/listinfo/eap-list

_______________________________________________
Eap-list mailing list
[EMAIL PROTECTED]
http://www.intellij.com/mailman/listinfo/eap-list

Reply via email to