mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-22 11:29:28 +07:00
1. Relational operators are promoted according to JLS, not always to double type (IDEA-199775) 2. Casting to boxed type is disabled, as JLS 15.28 suggests Result of boxed comparison like (Long)128L == (Long)128L is unknown now as size of boxing cache is not specified in JLS
19 lines
843 B
Java
19 lines
843 B
Java
class Foo {
|
|
public void foo() {
|
|
Integer a = 128;
|
|
Integer b = (int) a;// cast is necessary because new object is created
|
|
Integer c = 128;
|
|
|
|
System.out.println(a == b);
|
|
System.out.println(a == c); // Not known: integer cache could be enlarged and in general VM is free to cache more integral values
|
|
System.out.println(<warning descr="Result of 'a.equals(b)' is always 'true'">a.equals(b)</warning>);
|
|
System.out.println(<warning descr="Result of 'a.equals(c)' is always 'true'">a.equals(c)</warning>);
|
|
|
|
System.out.println((Long)128L == (Long)128L);
|
|
System.out.println(<warning descr="Condition '128 == 128' is always 'true'">128 == 128</warning>);
|
|
|
|
System.out.println((Long)128L != (Long)128L);
|
|
System.out.println(<warning descr="Condition '128 != 128' is always 'false'">128 != 128</warning>);
|
|
}
|
|
|
|
} |