hg: valhalla/valhalla: 8199452: [lworld] Check#checkRefType is too strict and forbids various legitimate operations on value classes

Srikanth srikanth.adayapalam at oracle.com
Mon Mar 12 10:24:23 UTC 2018



On Monday 12 March 2018 03:49 PM, srikanth.adayapalam at oracle.com wrote:
> Changeset: 44a050354dfc
> Author:    sadayapalam
> Date:      2018-03-12 15:44 +0530
> URL:       http://hg.openjdk.java.net/valhalla/valhalla/rev/44a050354dfc
>
> 8199452: [lworld] Check#checkRefType is too strict and forbids various legitimate operations on value classes

Notes:

Due to some code that was carried over unmodified from the original 
valhalla prototype, javac was forbidding various operations on value 
types that are legitimate in the lworld (or that ought to be - please 
holler if you see something amiss) such as:

     - Value types can be type arguments in generic type parameterizations.
     - Value types can be explicit type witnesses in generic method 
invocations
     - Value types can be wildcard bounds (even if only with limited 
utility on account of being final classes - a la String)
     - Value types can be intersection (cast) type components (FWIW),
     - Value instances can be enclosing instances in instance creation 
expressions

(In the original valhalla prototype, as values were rooted at a point 
other than j.l.O such forbiddance made sense. (e.g values cannot be type 
arguments unless a class was any'fied)

(Whether values should be restricted to top level classes, or can also 
be inner local nested is tagged
as an open design question - but javac already supports  them as non-top 
level classes also, but that support is partial and broken in ways that 
are addressed by a fix to this ticket)

Thanks!
Srikanth

>
> ! src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java
> ! src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java
> + test/langtools/tools/javac/valhalla/lworld-values/ValuesAsRefs.java
>



More information about the valhalla-dev mailing list