Ambiguous Comparison Hint

Posted by Ondrej Brejla on Oracle Blogs See other posts from Oracle Blogs or by Ondrej Brejla
Published on Wed, 17 Oct 2012 09:35:51 +0000 Indexed on 2012/10/17 11:11 UTC
Read the original article Hit count: 332

Filed under:

Hi everybody! Today we would like to show you some new hint which will be available in NetBeans 7.3. It's called Ambiguous Comparison hint.

Its name seems to be quite fuzzy, but it describes exactly what the hint does. It tries to check all comparisons whether they are intended. Because sometimes you want to make a simple assignment, but you make a typo and comparison appears. It's really dangerous mistake because then your code doesn't work as expected. Your application can produce buggy results. So here is how it looks like:

Ambiguous Comparison Hint

But sometimes a comparison is really intended. E.g. in return statements when you want to return a boolean, so then the hint works as expected and no warning appears.

Ambiguous Comparison Hint

That's all for today and as usual, please test it and if you find something strange, don't hesitate to file a new issue (component php, subcomponent Editor). Thanks.

© Oracle Blogs or respective owner

Related posts about /Features