RFR: 8277106: Cannot compile certain sources with --release [v2]

Halil İbrahim Şener duke at openjdk.java.net
Thu Apr 28 10:57:03 UTC 2022

On Tue, 7 Dec 2021 14:01:00 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:

>> 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. This solves the problem a). Solution for problem b) will be separate.
>> 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
> Jan Lahoda 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 three additional commits since the last revision:
>  - Removing aspects related to sealed classes.
>  - Merge branch 'master' into JDK-8277106
>  - 8277106: Cannot compile certain sources with --release

@lahodaj - this may not be the right place to ask this question, but will this fix be backported to 17? I am getting the same `class file for jdk.internal.event.Event not found` error with JDK 17.0.3.


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

More information about the compiler-dev mailing list