Local Variable Type Inference - prototype
Maurizio Cimadamore
maurizio.cimadamore at oracle.com
Fri Mar 11 16:30:05 UTC 2016
Fixed - thanks
Maurizio
On 11/03/16 14:11, forax at univ-mlv.fr wrote:
> Another bug,
>
> public static void main(String[] args) throws Throwable {
> for(var i = 0; i < 3; i++) {
> // ok
> }
> System.out.println("foo"); // statement unreachable ??
> }
>
> cheers,
> Rémi
>
> ----- Mail original -----
>> De: "Maurizio Cimadamore" <maurizio.cimadamore at oracle.com>
>> À: "Remi Forax" <forax at univ-mlv.fr>
>> Cc: platform-jep-discuss at openjdk.java.net
>> Envoyé: Vendredi 11 Mars 2016 14:19:44
>> Objet: Re: Local Variable Type Inference - prototype
>>
>> Fix pushed - thanks
>>
>> Maurizio
>>
>> On 11/03/16 10:57, Maurizio Cimadamore wrote:
>>>
>>> On 11/03/16 07:59, Remi Forax wrote:
>>>> Hi Maurizio, hi all,
>>>> currently, this compiles
>>>>
>>>> public class VarTest {
>>>> var x = 3;
>>>> static final var FOO = 3;
>>>> }
>>>>
>>>> while i don't care too much about being able to declare final static
>>>> field with var,
>>>> being able to declare instance field with var is plainly wrong for me
>>>> (and out of the scope of this JEP).
>>> That's outside the scope, and it's a bug in the implementation. I will
>>> fix this.
>>>
>>> Maurizio
>>>> Rémi
>>>>
>>>> ----- Mail original -----
>>>>> De: "Maurizio Cimadamore" <maurizio.cimadamore at oracle.com>
>>>>> À: platform-jep-discuss at openjdk.java.net
>>>>> Envoyé: Jeudi 10 Mars 2016 15:48:25
>>>>> Objet: Local Variable Type Inference - prototype
>>>>>
>>>>> Hi,
>>>>> I've pushed the first iteration of the local variable type inference
>>>>> prototype in the sandbox repository[1]. For those willing and brave
>>>>> enough to experiment, the branch name is "JEP-286-branch". We are also
>>>>> working to get some ready-made binary snapshots out of the door and
>>>>> hope
>>>>> to have an update on that soon.
>>>>>
>>>>> This first iteration supports the 'var-only' syntax style:
>>>>>
>>>>> var s = "Hello!";
>>>>>
>>>>> That is, the type of 's' is inferred from the initializer, and no
>>>>> special assumption is made about mutability.
>>>>>
>>>>> Please share your experience with the prototype. For comments on this
>>>>> feature please refer to the survey[2] that Brian posted few days ago.
>>>>>
>>>>> Maurizio
>>>>>
>>>>> [1] - http://cr.openjdk.java.net/~chegar/docs/sandbox.html
>>>>> [2] -
>>>>> http://mail.openjdk.java.net/pipermail/platform-jep-discuss/2016-March/000037.html
>>>>>
>>>>>
>>
More information about the platform-jep-discuss
mailing list