While working on JDK-8277105[1], it turned out the historical data in `ct.sym` 
are not quite right in two directions:
a) some API classes extend classes from non-exported packages (often from the 
`java.base` module). Examples include `jdk.jfr.Event` which extends 
`jdk.internal.event.Event`. As the current `ct.sym` data do not keep classes 
from non-exported packages, compilation against these classes fails.
b) permitted subtypes may include classes from non-exported packages, and these 
are needed to properly determine validity of casts and pattern matching 
switches. But these classes are not kept in the `ct.sym`, and hence the 
behavior of the casts may be incorrect. (Although I am no aware of any cases 
where an actual problem would arise with the current APIs.)

The proposed solution is to keep a certain amount of classes from non-exported 
packages in the historical record, specifically classes that are either 
extended by a class in an exported package, or named as a permitted subclass in 
an exported package.

The first occurrence of a) I was able to find was in JDK 11, so this patch also 
fixes the historical record till JDK 11.

[1] https://bugs.openjdk.java.net/browse/JDK-8277105

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

Commit messages:
 - 8277106: Cannot compile certain sources with --release

Changes: https://git.openjdk.java.net/jdk/pull/6417/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=6417&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8277106
  Stats: 1955 lines in 22 files changed: 1849 ins; 39 del; 67 mod
  Patch: https://git.openjdk.java.net/jdk/pull/6417.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/6417/head:pull/6417

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

Reply via email to