FULL PRODUCT VERSION :
C:\Users\Tim>java -version
java version "1.8.0_65"
Java(TM) SE Runtime Environment (build 1.8.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.65-b01, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Windows 10 x64
A DESCRIPTION OF THE PROBLEM :
Try running this:
public class Main {
public static void main(String[] args) {
Long var = null;
System.out.println("text" == null ? 0L : var);
}
}
I only get NullPointerException when i use a Number value.
To fix this, I need to cast the long value like this:
Long var = null;
System.out.println("text" == null ? (Long)0L : var);
REPRODUCIBILITY :
This bug can be reproduced always.
C:\Users\Tim>java -version
java version "1.8.0_65"
Java(TM) SE Runtime Environment (build 1.8.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.65-b01, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Windows 10 x64
A DESCRIPTION OF THE PROBLEM :
Try running this:
public class Main {
public static void main(String[] args) {
Long var = null;
System.out.println("text" == null ? 0L : var);
}
}
I only get NullPointerException when i use a Number value.
To fix this, I need to cast the long value like this:
Long var = null;
System.out.println("text" == null ? (Long)0L : var);
REPRODUCIBILITY :
This bug can be reproduced always.
- duplicates
-
JDK-8360162 Compiler wrongly add an invokevirtual of *numeric*Value
-
- Closed
-