As a flood of replies flow in...
if component were null, getName() would always throw
an exception and the next line would not be reached.
Carlos Costa e Silva wrote:
>
> Win2k sp2, jdk1.3.1, idea #612
>
>
>
> package pt.keysoft.ztest;
>
> import javax.swing.JComponent;
>
> public class TestInspection {
>
> void test() {
> JComponent component = getComponent();
> final String componentName = component.getName();
> if (component == null || !"xxx".equals(componentName)) {
> return;
> }
>
> }
>
> private JComponent getComponent() {
> return null;
> }
> }
>
> Inspection erroneously suggests:
>
> Condition component == null is always false.
> And possibly the same error, component.getName() isn't flagged as a
> possible NPE.
>
> Carlos
>
--
Erb
==============================================================
"The only time I like in the morning is afternoon."
- Russell D. Cooper
"If you do everything, then you're all done."
- Melissa F. Cooper
"Most of you are familiar with the virtues of a programmer.
There are three, of course: laziness, impatience, and hubris."
- Larry Wall
==============================================================
_______________________________________________
Eap-list mailing list
[EMAIL PROTECTED]
http://www.intellij.com/mailman/listinfo/eap-list