hg: valhalla/valhalla: 8197791: Allow null to be cast into a value type (for now)

Srikanth srikanth.adayapalam at oracle.com
Tue Feb 20 10:40:52 UTC 2018



On Tuesday 20 February 2018 04:06 PM, srikanth.adayapalam at oracle.com wrote:
> Changeset: 4d91ea65f463
> Author:    sadayapalam
> Date:      2018-02-20 16:01 +0530
> URL:       http://hg.openjdk.java.net/valhalla/valhalla/rev/4d91ea65f463
>
> 8197791:  Allow null to be cast into a value type (for now)

Notes:

Javac's assignability check and castability check share the same
innards viz the TypeRelation isSubtype. In preparation for JDK-8197911, 
I am having to
relax the null assignment (where statically discernible) to value types 
and that automatically
allows nulls to cast into value types. I am inclined to think allowing 
one while disallowing the
other does not make sense or for consistency at the type system level.

I will however continue to monitor all discussions in this space and 
react suitably. Note that ATM, checkcast is silent on nulls being cast 
to value class.

Thanks!
Srikanth


>
> ! src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java
> ! test/langtools/tools/javac/valhalla/lworld-values/CheckNullAssign.java
> ! test/langtools/tools/javac/valhalla/lworld-values/CheckNullCastable.java
> ! test/langtools/tools/javac/valhalla/lworld-values/CheckNullCastable.out
>




More information about the valhalla-dev mailing list