JDK-8157476 : -Wlogical-not-parentheses warnings in JRSUIConstantSync.m
  • Type: Bug
  • Component: client-libs
  • Affected Version: 9
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2016-05-20
  • Updated: 2016-07-14
  • Resolved: 2016-06-08
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9 b127Fixed
Related Reports
Relates :  
Description
In Mac OS X with Xcode 7.3, building java.desktop produces hundreds of lines of warnings like this:

/Users/dan/Dev/jdk/jdk9/jdk/src/java.desktop/macosx/native/libosxui/JRSUIConstantSync.m:132:5: warning: logical not is only applied to the left hand side of this comparison [-Wlogical-not-parentheses]
    CONSISTENCY_CHECK(Key, value);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/dan/Dev/jdk/jdk9/jdk/src/java.desktop/macosx/native/libosxui/JRSUIConstantSync.m:96:10: note: expanded from macro 'CONSISTENCY_CHECK'
    if ( !CONSTANT_CHECK(clazz, constant) ) return NO;
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/dan/Dev/jdk/jdk9/jdk/src/java.desktop/macosx/native/libosxui/JRSUIConstantSync.m:132:5: note: add parentheses after the '!' to evaluate the comparison first

It appears innocent, but produces a lot of noise (and, if I configure without "--disable-warnings-as-errors", breaks the build).
Comments
noreg-hard: code appears to be asserting consistency of the underlying system; probably hard to create an inconsistent system
08-06-2016

http://mail.openjdk.java.net/pipermail/awt-dev/2016-May/011320.html
06-06-2016

Actually, this looks like it could be a bug: CONSISTENCY_CHECK(Key, value); expands to if ( !CONSTANT_CHECK(Key, value) ) return NO; which expands to if ( !JRS_CONSTANT(Key, value) == JNI_CONSTANT(Key, value) ) return NO; Could expand further, but now the bug is apparent -- this will evaluate to the same as one of: if ( 0 == JNI_CONSTANT(Key, value) ) return NO; or if ( 1 == JNI_CONSTANT(Key, value) ) return NO;
20-05-2016