Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
andrew-boyarshin opened this issue Sep 8, 2023 · 5 comments · Fixed by #19080
Closed

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

andrew-boyarshin opened this issue Sep 8, 2023 · 5 comments · Fixed by #19080

Comments

@andrew-boyarshin
Copy link

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.

@andrew-boyarshin andrew-boyarshin added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels Sep 8, 2023
@WojciechMazur WojciechMazur added compat:java area:parser and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Sep 8, 2023
@hamzaremmal hamzaremmal self-assigned this Nov 23, 2023
@He-Pin

This comment was marked as off-topic.

bishabosha added a commit that referenced this issue Feb 27, 2024
…9080)

Closes #18533 

---

This PR also adds the following directive to the vulpix infrastructure:
```scala
//> using javacOpt *
```
inspired by :
https://scala-cli.virtuslab.org/docs/reference/directives#javac-options
@Kordyjan Kordyjan added this to the 3.4.2 milestone Mar 28, 2024
@Kordyjan Kordyjan modified the milestones: 3.4.2, 3.5.0 May 10, 2024
@He-Pin
Copy link

He-Pin commented Jun 7, 2024

@Kordyjan I see, will this be backported to 3.3.4 ? thanks.

refs: davidB/scala-maven-plugin#782
refs: https://github.com/He-Pin/scala3-maven-compile-demo

@kubukoz
Copy link
Contributor

kubukoz commented Jun 14, 2024

Bumping - would love to see this in LTS.

@He-Pin
Copy link

He-Pin commented Jun 20, 2024

@WojciechMazur ping

@WojciechMazur
Copy link
Contributor

Yes, it will be backported to the LTS. When backporting we try to follow the order of changes in the main branch to reduce the amount of conflicts. There is a long queue so please be patient, thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants