RFR: 8337998: CompletionFailure in getEnclosingType attaching type annotations

Vicente Romero vromero at openjdk.org
Fri Aug 9 17:46:34 UTC 2024


On Wed, 7 Aug 2024 15:59:58 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.

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

> 76: 
> 77:         // now if we remove A.class there will be an error but javac should not crash
> 78:         tb.deleteFiles(out.resolve("A.class"));

here the problem doesn't seem to be with the annotation not being found but with the annotated type not being found right?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20495#discussion_r1711876910


More information about the compiler-dev mailing list