RFR: 8337998: CompletionFailure in getEnclosingType attaching type annotations [v2]

Vicente Romero vromero at openjdk.org
Mon Aug 12 21:15:32 UTC 2024


On Mon, 12 Aug 2024 18:15:55 GMT, Liam Miller-Cushon <cushon at openjdk.org> wrote:

>> This change fixes a `CompletionFailure` crash in javac when a missing class is discovered while attaching type annotations read from a class file.
>> 
>> Type annotations on classes are located with a type path starting on the 'outermost part of the type for which a type annotation is admissible', so annotating a type requires knowing its outer classes, and the call to `ClassType#getEnclosingType` can cause additional symbols to be completed.
>> 
>> This change handles the completion failures, and reports an error diagnostic instead of the current crash.
>
> Liam Miller-Cushon has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains six additional commits since the last revision:
> 
>  - Merge branch 'master' into JDK-8337998
>  - Update diagnostic key and text to refer to 'attaching', not 'reading' type annotations
>  - Update diagnostic key
>  - Update not-yet list
>  - Remove unused import
>  - 8337998: CompletionFailure in getEnclosingType attaching type annotations

Marked as reviewed by vromero (Reviewer).

test/langtools/tools/javac/annotations/typeAnnotations/CompletionErrorOnEnclosingType.java line 27:

> 25:  * @test
> 26:  * @bug 8332850
> 27:  * @summary XXX

looks good, nit: we will need a meaningful summary here

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

PR Review: https://git.openjdk.org/jdk/pull/20495#pullrequestreview-2234031307
PR Review Comment: https://git.openjdk.org/jdk/pull/20495#discussion_r1714375498


More information about the compiler-dev mailing list