RFR: 8347530: Improve error message with invalid permits clauses

Aggelos Biboudis abimpoudis at openjdk.org
Thu May 15 16:58:29 UTC 2025


Currently we report one kind of error message (`subclass {0} must extend sealed class`) when there is a compile-type error in cases like the following:


sealed class C0 permits S0 {}
class S0 {}  


This PR proposes to improve error reporting since there are other kinds of declarations that can also participate in sealed hierarchies like records, enums and interfaces.

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

Commit messages:
 - 8347530: Improve error message with invalid permits clauses

Changes: https://git.openjdk.org/jdk/pull/25255/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=25255&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8347530
  Stats: 84 lines in 7 files changed: 79 ins; 0 del; 5 mod
  Patch: https://git.openjdk.org/jdk/pull/25255.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/25255/head:pull/25255

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


More information about the compiler-dev mailing list