[java] numeric overflow inspection on left shift (IDEA-154370)

This commit is contained in:
Roman Shevchenko
2016-04-08 20:33:33 +02:00
parent 0dc69cd4fe
commit 6eefa1badb
2 changed files with 10 additions and 4 deletions
@@ -43,6 +43,7 @@ class c {
i1 = INTEGER_MAX_VALUE * -1;
<warning descr="Numeric overflow in expression">i1 = <warning descr="Numeric overflow in expression">2 / 0</warning></warning>;
<warning descr="Numeric overflow in expression">i1 = <warning descr="Numeric overflow in expression">INTEGER_MIN_VALUE / -1</warning></warning>;
<warning descr="Numeric overflow in expression">i1 = <warning descr="Numeric overflow in expression">1000 << 30</warning></warning>;
System.out.println(i1);
long l1 = <warning descr="Numeric overflow in expression">LONG_MAX_VALUE + 1</warning>;
@@ -64,10 +65,9 @@ class c {
<warning descr="Numeric overflow in expression">l1 = <warning descr="Numeric overflow in expression">2 / 0L</warning></warning>;
<warning descr="Numeric overflow in expression">l1 = <warning descr="Numeric overflow in expression">2 % 0L</warning></warning>;
<warning descr="Numeric overflow in expression">l1 = <warning descr="Numeric overflow in expression">LONG_MIN_VALUE / -1</warning></warning>;
<warning descr="Numeric overflow in expression">l1 = <warning descr="Numeric overflow in expression">30 * 24 * 60 * 60 * 1000</warning></warning>;
<warning descr="Numeric overflow in expression">l1 = <warning descr="Numeric overflow in expression"><warning descr="Numeric overflow in expression">30000000 * 243232323 * <warning descr="Numeric overflow in expression">(<warning descr="Numeric overflow in expression">LONG_MAX_VALUE +3</warning>)</warning></warning> / 5</warning></warning>;
<warning descr="Numeric overflow in expression">l1 = <warning descr="Numeric overflow in expression">1000 << 62</warning></warning>;
System.out.println(l1);
}