forEach broken in build 48?
bitter_fox
bitterfoxc at gmail.com
Thu Jul 26 03:12:53 PDT 2012
I read that statement: if it was already erased I make erasure and if it
was not I don't make erasure.
And I thought it is opposite.
But I think it is my misreading, reading your mail.
Regard,
bitter_fox
2012/7/26 Maurizio Cimadamore <maurizio.cimadamore at oracle.com>
> On 26/07/12 03:53, bitter_fox wrote:
>
>> Hi, Arul and Mike
>> I guess Revision(langtools):1430[1] has a problem.
>>
>> In LambdaTranslator#**makeFunctionalDescriptorType:
>> return erased ? types.erasure(descType) : descType;
>>
>> This is wrong I think.
>>
> Why do you think it's wrong? The code is meant to erase the descriptor
> type only if the erased flagh is set (which only is when doing 292
> translation).
>
> Maurizio
>
>
>> I tried this one and the problem looks resolved:
>> return erased ? descType : types.erasure(descType);
>>
>> Please ignore this mail if you already notice that.
>>
>> [1]:http://mail.openjdk.java.**net/pipermail/lambda-dev/2012-**
>> July/005187.html<http://mail.openjdk.java.net/pipermail/lambda-dev/2012-July/005187.html>
>>
>> Regards,
>> bitter_fox
>>
>>
>> 2012/7/26 Mike Duigou <mike.duigou at oracle.com>
>>
>> I've looked into the problem and am able to replicate it. I did some
>>> debugging and it appears to be a problem in the VM. I am notifying those
>>> working on this area.
>>>
>>> Mike
>>>
>>>
>>> On Jul 21 2012, at 01:39 , Arul Dhesiaseelan wrote:
>>>
>>> Hi,
>>>>
>>>> It looks like forEach is broke in the latest build. It always prints the
>>>> last item in the collection. It works fine in b45. It works in b48 only
>>>>
>>> if
>>>
>>>> we expand the code, not if we perform method reference on an instance.
>>>>
>>>> public class InstanceMethodReference {
>>>>
>>>> public static void main(String[] args) {
>>>> Arrays.asList("Alice", "Bob", "Charlie",
>>>> "Dave").forEach(System.out::**println);//INCORRECT RESULT
>>>> Arrays.asList("Alice", "Bob", "Charlie", "Dave").forEach(new
>>>> MyBlock(System.out));//CORRECT RESULT
>>>> }
>>>>
>>>> public static class MyBlock implements Block<String> {
>>>> PrintStream ps;
>>>>
>>>> public MyBlock(PrintStream ps) {
>>>> this.ps = ps;
>>>> }
>>>>
>>>> @Override
>>>> public void apply(String s) {
>>>> ps.println(s);
>>>> }
>>>> }
>>>> }
>>>>
>>>> build45 correctly prints:
>>>> Alice
>>>> Bob
>>>> Charlie
>>>> Dave
>>>> Alice
>>>> Bob
>>>> Charlie
>>>> Dave
>>>>
>>>> build48 prints:
>>>> Dave
>>>> Dave
>>>> Dave
>>>> Dave
>>>> Alice
>>>> Bob
>>>> Charlie
>>>> Dave
>>>>
>>>>
>>>> -Arul
>>>>
>>>>
>>>
>>>
>
More information about the lambda-dev
mailing list