On Thu, 26 Mar 2026 13:49:32 GMT, Jan Lahoda <[email protected]> wrote:

> Consider code like:
> 
> import unknown.Unknown;
> class T {
>     Unknown u;
> }
> 
> 
> compiling this leads to:
> 
> $ javac /tmp/T.java 
> /tmp/T.java:1: error: package unknown does not exist
> import unknown.Unknown;
>               ^
> /tmp/T.java:3: error: cannot find symbol
>     Unknown u;
>     ^
>   symbol:   class Unknown
>   location: class T
> 2 errors
> 
> 
> And in the AST the error type for `Unknown` in `Unknown u` does not refer to 
> `unknown.Unknown` at all.
> 
> This PR is trying to improve this, by keeping track unresolvable types that 
> are (single-name) imported, and using their symbols when attributing 
> references.
> 
> With this patch, the error reported is:
> 
> $ javac /tmp/T.java 
> /tmp/T.java:1: error: package unknown does not exist
> import unknown.Unknown;
>               ^
> 1 error
> 
> 
> And the reference to `Unknown` is attributed as `unknown.Unknown`.

lgtm

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

Marked as reviewed by vromero (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/30452#pullrequestreview-4208973785

Reply via email to