RFR : JDK-8197439, , Crash with -XDfind=lambda for anonymous class in anonymous class.
Srikanth
srikanth.adayapalam at oracle.com
Wed Feb 21 05:13:16 UTC 2018
Hi Jan,
If the only changes in this revision are what were called out in the
earlier review, I am fine with the XDfind=lambda fix. FYI.
Thanks!
Srikanth
On Tuesday 20 February 2018 07:41 PM, Jan Lahoda wrote:
> On 20.2.2018 10:29, Srikanth wrote:
>>
>>
>> On Friday 09 February 2018 03:01 PM, Jan Lahoda wrote:
>>> Hi,
>>>
>>> For certain classes -XDfind=lambda will crash javac (please see the
>>> bug for details):
>>>
>> [...]
>>
>>> ---
>>>
>>> The reason is that:
>>> - -XDfind=lambda will try to replace "new I1() {...}" with a lambda
>>> and attribute that
>>> -but this will make I2 unresolvable
>>> -so Attr.visitNewClass will not (currently) attribute the inside of
>>> the "new I2() {}".
>>> -so Attr.PostAttrAnalyzer will try to fill in Symbols and Types, but
>>> "Attr.PostAttrAnalyzer.dummyMethodType" will dereference
>>> MethodTree.restype, which is null for constructors (in this case an
>>> automatically generated constructor).
>>>
>>> A part of the proposed fix is to enhance
>>> PostAttrAnalyzer.dummyMethodType to handle constructors.
>>
>> This part looks good.
>>
>>> But attributing the body of an unresolvable anonymous class does not
>>> seem difficult, and would help API clients like JShell, so the
>>> proposed fix is doing that as well.
>>
>> Not being a regular user of jshell, I am not able to form an assessment
>> as to how important this is - my lay person's opinion is that it is not,
>> but I will defer to your judgment. But the relevant changes in Attr look
>> reasonable.
>
> I think it is nicer for the users of the API to have the anonymous
> classes attributed, even if it may not be very important.
>
>>
>> AnonymousInAnonymous.java:
>>
>> (1) FWIW, it may be a better idea to capture the diagnostic issued by
>> XDfind=lambda and prepare a golden file ??
>
> Oops, yes, done.
>
>> (2) @module directive unnecessary here ?
>
> Not really sure, removed.
>
> Updated webrev:
> http://cr.openjdk.java.net/~jlahoda/8197439/webrev.01/
>
> Thanks for the comments so far!
>
> Jan
>
>>
>> Overall, I am fine with this patch,
>>
>> Sorry for the delayed response,
>> Thanks!
>> Srikanth
>>
>>
>>
More information about the compiler-dev
mailing list