RFR: 8322159: ThisEscapeAnalyzer crashes for erroneous code

Archie Cobbs acobbs at openjdk.org
Fri Dec 15 15:45:37 UTC 2023


On Fri, 15 Dec 2023 08:10:42 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:

> When an unresolvable method is used in the code, the model is a bit strange (and not very easy to fix) - for method invocations, the symbol used is actually a `ClassSymbol` instead of `MethodSymbol`, and method references have fields like `kind` unfilled.
> 
> This is causing issues in ThisEscapeAnalyzer when there were unresolvable methods, and the analyzer is called (i.e. in practice when running with `-Xlint:this-escape -XDshould-stop.at=FLOW`, or similar):
>  - `visitApply` has a hardcoded cast to `MethodSymbol`. Seems the case in not really necessary, so the proposal is to remove it.
>  - `visitReference` crashes on an access to `JCMemberReference.kind`, as it is unfilled. The proposal is to skip the check if the method reference's type is errneous.

Hi @lahodaj,

Looks good to me - thanks for fixing.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/17118#issuecomment-1858083342


More information about the compiler-dev mailing list