Skip to content

Java parser doesn't support JEP 409 sealed classes #18533

Closed
@andrew-boyarshin

Description

@andrew-boyarshin

Compiler version

3.3.1

Minimized code

Repo (branch 5)

package bug.code;

public sealed class Pet permits Cat, Dog {
}

Output

-- Error: .\src\code\Cat.java:3:14 ---------------------------------------------
3 |public sealed abstract class Cat extends Pet {
  |              ^^^^^^^^
  |              illegal start of type declaration
-- Error: .\src\code\Pet.java:3:14 ---------------------------------------------
3 |public sealed class Pet permits Cat, Dog {
  |              ^^^^^
  |              illegal start of type declaration
-- [E006] Not Found Error: .\src\code\Dog.java:3:31 ----------------------------
3 |public final class Dog extends Pet {
  |                               ^^^
  |                               Not found: type Pet
  |
  | longer explanation available when compiling with `-explain`
3 errors found

Expectation

Scala code compiles successfully in mixed mode, like in Scala 2.13.11. See also scala/bug#12171 for Scala 2 tracking issue.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions