Is V? what we need ?

forax at univ-mlv.fr forax at univ-mlv.fr
Thu May 2 19:48:20 UTC 2019


----- Mail original -----
> De: "John Rose" <john.r.rose at oracle.com>
> À: "Remi Forax" <forax at univ-mlv.fr>
> Cc: "Brian Goetz" <brian.goetz at oracle.com>, "valhalla-spec-experts" <valhalla-spec-experts at openjdk.java.net>
> Envoyé: Jeudi 2 Mai 2019 04:17:54
> Objet: Re: Is V? what we need ?

> It looks like we're getting somewhere; thanks for
> the detailed response.  I have one targeted reply:
> 
> On May 1, 2019, at 4:38 PM, forax at univ-mlv.fr wrote:
>> 
>> So let's call it V*. I want also make clear that there is no proposal to not
>> have a V*, we need it, and it's the L-version of an inline type for the VM.
> 
> That would an ugly choice, for sure.  But it's also a
> full disclosure of the presence of the indirection.
> 
>>> It's not fine to use Integer as parameter of a method.
> 
> There's one place where Integer is OK as a method
> parameter or return, and that is when you are reaching
> for null as a sentinel.  I'm pretty sure I've written code
> like that.

i should have added "in public API".

Here are the offending methods in JDK 12*:
  java.sql.JDBCType public java.lang.Integer java.sql.JDBCType.getVendorTypeNumber()
  java.sql.SQLType public abstract java.lang.Integer java.sql.SQLType.getVendorTypeNumber()
  java.util.PrimitiveIterator$OfInt public default java.lang.Integer java.util.PrimitiveIterator$OfInt.next()
  java.lang.Integer public static java.lang.Integer java.lang.Integer.valueOf(int)
  java.lang.Integer public static java.lang.Integer java.lang.Integer.valueOf(java.lang.String,int) throws java.lang.NumberFormatException
  java.lang.Integer public static java.lang.Integer java.lang.Integer.valueOf(java.lang.String) throws java.lang.NumberFormatException
  java.lang.Integer public java.lang.Integer java.lang.Integer.resolveConstantDesc(java.lang.invoke.MethodHandles$Lookup)
  java.lang.Integer public static java.lang.Integer java.lang.Integer.decode(java.lang.String) throws java.lang.NumberFormatException
  java.lang.Integer public static java.lang.Integer java.lang.Integer.getInteger(java.lang.String,int)
  java.lang.Integer public static java.lang.Integer java.lang.Integer.getInteger(java.lang.String)
  java.lang.Integer public static java.lang.Integer java.lang.Integer.getInteger(java.lang.String,java.lang.Integer)

> 
> This, I think, is why V* is OK to spell as V?.  My contribution
> to this conversation is to explain why, as one of Java's
> lumping-not-splitting design moves, we are adjoining
> the responsibilities of V* to the contract of V?.
> 
> If V? were purely a value-set variant of V, then V* and V?
> would be distinct and subtly different types.  But one of
> Java's super-powers is that it doesn't *do* that level of
> type refinement.

yes, i fully agree. 

> 
> — John

Rémi

* i've filtered out JMX because the API is reflection based with limitation on primitive types.


More information about the valhalla-spec-experts mailing list