RFR: 8338981: Access to private classes should be permitted inside the permits clause of the enclosing top-level class

Evemose duke at openjdk.org
Mon Aug 26 21:50:33 UTC 2024


Fix is quite hacky, but this is best solution that i came up with without making invasive changes in other parts of jdk. Basically, I check if current symbol is symbol for tree inside of permits clause i na following way:

1. env.tree is JCTree.JCClassDecl;
2. Trees in extends and implements clauses are already not null
3. There is at least one tree with null sym in permits clause (main indicator that permits clause resolution is in process)

Not sure if this is a correct way to do it, hope more expirienced people out here could look into it more carefully.

DEV NOTE: Will add test a bit later

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

Commit messages:
 - fix permit clause

Changes: https://git.openjdk.org/jdk/pull/20718/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=20718&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8338981
  Stats: 18 lines in 1 file changed: 18 ins; 0 del; 0 mod
  Patch: https://git.openjdk.org/jdk/pull/20718.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/20718/head:pull/20718

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


More information about the compiler-dev mailing list