Type Inference Question

Jan Finis jpfinis at gmail.com
Wed May 30 09:30:40 PDT 2012


On 05/30/2012 05:26 PM, Maurizio Cimadamore wrote:
>
> I haven't been clear - it's not the inference process (as described in 
> 15.12.2.7) that should be adjusted - it's the way in which you compute 
> the actual argument types. I.e. if your argument is an expression E, 
> the actual argument type to be used during method checking is 
> capture(upper(typeof(E))).
>
> Then you do inference as per JLS.
>
> In your first example, since typeof(E) was a captured variable, this 
> strategy might help you out - in the example above, the type of E is 
> List<?>, so doing upper(typeof(E)) won't change things.
Thank you so much,

I think I begin to understand. One last question: How do you define the 
upper bound of a type here? To aid my example, the upper bound of Set<? 
extends T> should be Set<T>, so is you upper() function applied 
recursively to type arguments? This is also one of the point where I had 
problems in the spec:

/cta(U) = ? if U's upper bound is Object, otherwise ? extends lub(U,Object)/

Here, the spec also talks about the upper bound of type U. But how is 
the upper bound of an arbitrary type defined? I cannot find it anywhere 
in the spec.

Thanks a lot!
Best regards,
Jan Finis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20120530/7ed3e922/attachment.html 


More information about the compiler-dev mailing list