All Downloads are FREE. Search and download functionalities are using the official Maven repository.

resources.report.rules.findbugs.BIT_SIGNED_CHECK.html Maven / Gradle / Ivy



BIT_SIGNED_CHECK

BIT: Check for sign of bitwise operation (BIT_SIGNED_CHECK)

This method compares an expression such as

((event.detail & SWT.SELECTED) > 0)
.

Using bit arithmetic and then comparing with the greater than operator can lead to unexpected results (of course depending on the value of SWT.SELECTED). If SWT.SELECTED is a negative number, this is a candidate for a bug. Even when SWT.SELECTED is not negative, it seems good practice to use '!= 0' instead of '> 0'.

Boris Bokowski





© 2015 - 2024 Weber Informatics LLC | Privacy Policy