RFR 8138840: NPE when compiling bitwise operations with illegal operand types

ShinyaYoshida bitterfoxc at gmail.com
Mon Oct 5 00:42:21 UTC 2015

Hi Jan, Maurizio and compiler group,
I found the NPE bug related to
It's for bitwise operations with illegal operand types:

int n = 0;
double d = 0;
System.out.println(n & d);

I've just filed this issue:


And I already have the fix for this.
Could you review my patch?


Now, BinaryNumericOperator is used for bitwise operators in Operators.
BinaryNumericOperator accepts numeric operand types but bitwise operators
should be allowed for integral types(JLS 15.22.1).
So the accepted types are same as shift operators'(BinaryShiftOperator).

In my change, I create BinaryBitwiseOperator which allows only the integral
types such as BinaryShiftOperator I use it for bitwise operators instead of
(And I also change the comment for BinaryBooleanOperator, because it is not
"bitwise operator(JLS 15.22.1)" but "logical operator(15.22.2).")

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20151005/07c18883/attachment.html>

More information about the compiler-dev mailing list