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.
Summary: | [69cat] Bogus hint for "Pointless bitwise expression" | ||
---|---|---|---|
Product: | java | Reporter: | swpalmer <swpalmer> |
Component: | Hints | Assignee: | Jan Lahoda <jlahoda> |
Status: | VERIFIED FIXED | ||
Severity: | normal | CC: | albert_kurucz, emiddio, johnco3, rbalada, sperl |
Priority: | P2 | ||
Version: | 6.x | ||
Hardware: | All | ||
OS: | All | ||
Issue Type: | DEFECT | Exception Reporter: | |
Attachments: |
Test case demonstrates the bug as described in comments.
screenshot from NB 6.9.1 |
Description
swpalmer
2010-04-26 14:13:26 UTC
// mask off the XYZ & 1 bits (bits 0-3) int unpackedData = ((aRawBytes[0] & 0xf0) << 24)| // <-- this line causes prob ((aRawBytes[1] & 0xfe) << 20)| ((aRawBytes[2] & 0xfe) << 13)| ((aRawBytes[3] & 0xfe) << 6) | ((aRawBytes[4] & 0xfe) >>> 1); if (((aRawBytes[0] & 0x01) != 0) && // <-- also here ((aRawBytes[1] & 0x01) == 0) && ((aRawBytes[2] & 0x01) == 0) && ((aRawBytes[3] & 0x01) == 0) && ((aRawBytes[3] & 0x01) == 0)) { *** Bug 187214 has been marked as a duplicate of this bug. *** Fixed in trunk: http://hg.netbeans.org/jet-main/rev/7ae50ebca759 Verified. Product Version: NetBeans IDE Dev (Build 100609-3434882e3270) Java: 1.6.0_18; Java HotSpot(TM) Client VM 16.0-b13 System: Linux version 2.6.31-22-generic running on i386; UTF-8; en_US (nb) Integrated into 'main-golden', will be available in build *201006100001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/7ae50ebca759 User: Jan Lahoda <jlahoda@netbeans.org> Log: #185010: when trying to evaluate arithmetic expression, make sure the root tree of the expression is also checked against accepted kinds. For porting into release691 repository, I would like to ask for advice. The changeset [1] updates file [2]. Unfortunately the file [2] does not exist in release691 repository [3]. I would like to ask for recommendation how to proceed. I have got two options: #1 I can backport also changeset [4] for issue 186347 [5] and then backport the original changeset [1] for this issue (185010). #2 I can do minimal backport of the changeset [1] for this issue (185010), ignoring the change in file [2]. If you recommend solution #1, I need you to add 6.9.1_CANDIDATE keyword to the issue 186347 [5] and request a verification of the bugfix. References: [1] http://hg.netbeans.org/main/rev/7ae50ebca759 [2] java.hints/test/unit/src/org/netbeans/modules/java/hints/ArithmeticUtilitiesTest.java [3] http://hg.netbeans.org/release691/file/tip/java.hints/test/unit/src/org/netbeans/modules/java/hints/ArithmeticUtilitiesTest.java [4] http://hg.netbeans.org/main/rev/d7f5369e419d [5] http://netbeans.org/bugzilla/show_bug.cgi?id=186347 Sorry for late answer. I have marked bug #186347 as a 6.9.1. candidate too, but merging the test is not very important IMO - the change in ArithmeticUtilities.java is much more important. Transplanted main #7ae50ebca759 to release691 #2d38eeec5c54 *** Bug 187854 has been marked as a duplicate of this bug. *** *** Bug 188099 has been marked as a duplicate of this bug. *** *** Bug 188273 has been marked as a duplicate of this bug. *** Verified in NetBeans IDE 6.9.1 Dev (Build 201007062301). Created attachment 100659 [details]
Test case demonstrates the bug as described in comments.
This may not be the same issue but maybe it is. See my test Test.java. There is a warning at line 5 and 9, but not lines 6, 7, and 8, so it appears to be dependent on the array index 0. The tooltip text says "pointless bitwise expression" but when I use Alt-enter to see the actions, the default action is "Zero constant should be removed", which is not the same thing at all! And if I tell it to go ahead, the resulting expression: int b0 = 0x0F; has a completely different meaning! Created attachment 100677 [details]
screenshot from NB 6.9.1
As you can see in image attached by myself, it's really fixed in NetBeans 6.9.1. This fix isn't accessible for NB 6.9 so please just wait for 6.9.1 release - it will solve your troubles. Marking as fixed again. Verified for NetBeans IDE 6.9.1 Dev (Build 201007062301) again. |