RFR : JDK-8197439, , Crash with -XDfind=lambda for anonymous class in anonymous class.
Srikanth
srikanth.adayapalam at oracle.com
Tue Feb 20 09:29:35 UTC 2018
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.
AnonymousInAnonymous.java:
(1) FWIW, it may be a better idea to capture the diagnostic issued by
XDfind=lambda and prepare a golden file ??
(2) @module directive unnecessary here ?
Overall, I am fine with this patch,
Sorry for the delayed response,
Thanks!
Srikanth
More information about the compiler-dev
mailing list