FULL PRODUCT VERSION :
java version "1.6.0_24"
Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7601]
A DESCRIPTION OF THE PROBLEM :
The following code should not compile, however it does compile and throws NullPointerException
public int foo()
{
return 1==1 ? null : 1;
}
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
See description
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
This code should not compile. I should not be able to return null if the method signature expects int
ACTUAL -
Code was compiled without any warning or error.At runtime this code produces NullPonterException
REPRODUCIBILITY :
This bug can be reproduced always.
java version "1.6.0_24"
Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7601]
A DESCRIPTION OF THE PROBLEM :
The following code should not compile, however it does compile and throws NullPointerException
public int foo()
{
return 1==1 ? null : 1;
}
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
See description
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
This code should not compile. I should not be able to return null if the method signature expects int
ACTUAL -
Code was compiled without any warning or error.At runtime this code produces NullPonterException
REPRODUCIBILITY :
This bug can be reproduced always.
- duplicates
-
JDK-8360162 Compiler wrongly add an invokevirtual of *numeric*Value
-
- Closed
-