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

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

Commit messages:
 - Improving test.
 - Updating copyright year.
 - Fixing test.
 - Cleanup.
 - 8378102: Validly imported symbols of unresolved types do not have their FQN 
reflected in the Element/TypeMirror instances passed to annotation processors

Changes: https://git.openjdk.org/jdk/pull/30452/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=30452&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8378102
  Stats: 339 lines in 8 files changed: 223 ins; 63 del; 53 mod
  Patch: https://git.openjdk.org/jdk/pull/30452.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/30452/head:pull/30452

PR: https://git.openjdk.org/jdk/pull/30452

Reply via email to