This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 188099

Summary: Zero constant in array index is wrongly recognized as Zero constant
Product: java Reporter: albert_kurucz <albert_kurucz>
Component: HintsAssignee: Jan Lahoda <jlahoda>
Status: RESOLVED DUPLICATE    
Severity: normal    
Priority: P3    
Version: 6.x   
Hardware: PC   
OS: Windows XP   
Issue Type: DEFECT Exception Reporter:

Description albert_kurucz 2010-06-25 17:20:47 UTC
Example code:

    int intValue(byte[] a) {
        return (0xff & a[0]) + (0xff & a[1]) << 8;
    }


The part "0xff & a[0]" is underlined in Netbeans 6.9 editor as "Pointless bitwise expression".

Clicking on the hint bulb shows: "Zero constant should be removed"

After accepting the hint, the code shows:

    int intValue(byte[] a) {
        return (0xff) + (0xff & a[1]) << 8;
    }


This is wrong!
Comment 1 Jan Lahoda 2010-06-29 11:23:38 UTC
Has been fixed as bug #185010, should be part of NB6.9.1. Thanks for the report.

*** This bug has been marked as a duplicate of bug 185010 ***