RFR 8138840: NPE when compiling bitwise operations with illegal operand types
Maurizio Cimadamore
maurizio.cimadamore at oracle.com
Fri Oct 9 12:29:49 UTC 2015
(dropping jdk9-dev)
Hi Shinya
we are working on this - thanks for the patch - we are investigating a
very similar fix.
Maurizio
On 05/10/15 01:42, ShinyaYoshida wrote:
> Hi Jan, Maurizio and compiler group,
> I found the NPE bug related to
> http://hg.openjdk.java.net/jdk9/dev/langtools/rev/098657cc98c9
> 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:
>
> https://bugs.openjdk.java.net/browse/JDK-8138840
>
> And I already have the fix for this.
> Could you review my patch?
>
> http://cr.openjdk.java.net/~shinyafox/8138840/webrev.00/
>
> 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
> BinaryNumericOperator.
> (And I also change the comment for BinaryBooleanOperator, because it is not
> "bitwise operator(JLS 15.22.1)" but "logical operator(15.22.2).")
>
> Regards,
> shinyafox
More information about the compiler-dev
mailing list