RFR: JDK-8265270: Type.getEnclosingType() may fail with CompletionFailure
Jan Lahoda
jlahoda at openjdk.java.net
Thu Apr 15 11:36:04 UTC 2021
The setup is a little bit tricky, but it may happen that user code calls `Type{Mirror}.getEnclosingType()` (or e.g. `Type{Mirror}.toString()` which will in turn invoke `getEnclosingType()`), and the method may throw the `CompletionFailure` (internal) exception. The reason is that the corresponding Symbol is completed using a `complete` method, instead of `apiComplete` method, which is intended to be used in API methods. `apiComplete` does the same as `complete` when running in a javac context, but will suppress the exception when the API method was invoked from a user code, avoiding the exception.
The proposed change is to use `apiComplete`, as it should be done in implementations of API methods.
-------------
Commit messages:
- JDK-8265270: Type.getEnclosingType() may fail with CompletionFailure
Changes: https://git.openjdk.java.net/jdk/pull/3512/files
Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=3512&range=00
Issue: https://bugs.openjdk.java.net/browse/JDK-8265270
Stats: 61 lines in 2 files changed: 59 ins; 0 del; 2 mod
Patch: https://git.openjdk.java.net/jdk/pull/3512.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/3512/head:pull/3512
PR: https://git.openjdk.java.net/jdk/pull/3512
More information about the compiler-dev
mailing list