RFR: 8345944: JEP 492: extending local class in a different static context should not be allowed

Maurizio Cimadamore mcimadamore at openjdk.org
Wed Dec 11 11:38:21 UTC 2024


This PR fixes a couple of issues associated with the implementation of the new stricter checks for local class creation defined by JEP 492.
There are two issues:
* the new checks do not apply to _all_ local classes, especially those whose owner happens to be a _variable_;
* the new checks do not apply when a class _extends_ a local class -- that's because javac only checks superclasses in the case the superclass is an _inner_ class

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

Commit messages:
 - Add tests
 - Initial push

Changes: https://git.openjdk.org/jdk/pull/22679/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=22679&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8345944
  Stats: 275 lines in 6 files changed: 266 ins; 4 del; 5 mod
  Patch: https://git.openjdk.org/jdk/pull/22679.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/22679/head:pull/22679

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


More information about the compiler-dev mailing list