RFR: 8322159: ThisEscapeAnalyzer crashes for erroneous code
Jan Lahoda
jlahoda at openjdk.org
Fri Dec 15 08:16:59 UTC 2023
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.
-------------
Commit messages:
- 8322159: ThisEscapeAnalyzer crashes for erroneous code
Changes: https://git.openjdk.org/jdk/pull/17118/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=17118&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8322159
Stats: 44 lines in 2 files changed: 41 ins; 0 del; 3 mod
Patch: https://git.openjdk.org/jdk/pull/17118.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/17118/head:pull/17118
PR: https://git.openjdk.org/jdk/pull/17118
More information about the compiler-dev
mailing list