Integrated: JDK-8265270: Type.getEnclosingType() may fail with CompletionFailure

Jan Lahoda jlahoda at openjdk.java.net
Wed Jun 2 09:57:47 UTC 2021


On Thu, 15 Apr 2021 11:29:44 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:

> 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.

This pull request has now been integrated.

Changeset: 9247630a
Author:    Jan Lahoda <jlahoda at openjdk.org>
URL:       https://git.openjdk.java.net/jdk/commit/9247630a0d024550813f651c1ec0ce228ff27210
Stats:     61 lines in 2 files changed: 59 ins; 0 del; 2 mod

8265270: Type.getEnclosingType() may fail with CompletionFailure

Reviewed-by: vromero

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

PR: https://git.openjdk.java.net/jdk/pull/3512


More information about the compiler-dev mailing list