<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><p>Hello Amber Team,</p><p>I’ve observed a counter intuitive behavior, and I’m unsure whether it’s intentional or a potential issue.</p><p>Here’s the scenario:</p><ol><li>I have a package named <code>vehicles</code> containing a <strong>sealed interface</strong> called <code>Vehicle</code>.</li><li>Inside this <code>vehicles</code> package, I’ve created two sub-packages:<ul><li><code>land-vehicles</code></li><li><code>water-vehicles</code></li></ul></li><li>Each sub-package contains two records implementing the <code>Vehicle</code> interface.</li></ol><p>However, the compiler raises an error when I attempt this setup:</p><blockquote><p>"A class is not allowed to extend or implement a sealed class from another package."</p></blockquote><p>This seems counterintuitive because all components are conceptually part of the same package with the records merely placed in sub-packages for better organization.</p><p>Here’s a textual representation of the package layout for reference:</p><p><br></p><p>vehicles/</p><p>├── Vehicle.java            // Sealed interface</p><p>├── land-vehicles/</p><p>│   ├── Car.java            // Record implementing Vehicle</p><p>│   ├── Motorcycle.java     // Record implementing Vehicle</p><p>├── water-vehicles/</p><p>    ├── Boat.java           // Record implementing Vehicle</p><p>    ├── Submarine.java      // Record implementing Vehicle</p><p><br></p><p>Could you clarify whether this behavior is intended or a bug? If not, could this be an area for potential improvement?</p><p>I am using openjdk 23.0.1</p><p>Thank you for your time and assistance!</p><p>Best regards and I hope you all have a nice new year.</p></div></div></div></div></div></div></div>