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

when clause not working with JDK 21 #27

Closed
ice1000 opened this issue May 10, 2024 · 3 comments
Closed

when clause not working with JDK 21 #27

ice1000 opened this issue May 10, 2024 · 3 comments

Comments

@ice1000
Copy link
Contributor

ice1000 commented May 10, 2024

public class Test {
  sealed interface I {}
  record A(int a) implements I {}

  public static void main(String[] args) {
    I i = new A(1);
    switch (i) {
      case A(var a) when a == 1 -> System.out.println(a);
      default -> System.out.println("default");
    }
  }
}

After installing the manifold plugin, IntelliJ IDEA can no longer parse the above code:
image

Environment:

IntelliJ IDEA 2024.1.2 Preview (Ultimate Edition)
Build #IU-241.17011.2, built on May 7, 2024
Licensed to Yinsen Zhang
Subscription is active until January 8, 2025.
For educational use only.
Runtime version: 17.0.11+1-b1207.20 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 11.0
GC: G1 Young Generation, G1 Old Generation
Memory: 2010M
Cores: 20
Registry:
  debugger.new.tool.window.layout=true
  ide.experimental.ui=true
  ide.images.show.chessboard=true
Non-Bundled Plugins:
  org.canonical.intellij (1.0)
  PsiViewer (241.14494.158-EAP-SNAPSHOT)
  com.jetbrains.darkPurpleTheme (1.3)
  com.jetbrains.space (241.17011.2)
  manifold.ij (2023.3.27)
  org.jetbrains.idea.grammar (2022.3.2)
  org.ice1000.kala (0.8)
  org.aya.intellij (0.0.1-SNAPSHOT)
  fuck.idea.jpms (SNAPSHOT)
  com.github.copilot (1.5.3.5510)
  com.perl5 (241.13688.18-EAP-SNAPSHOT)
Kotlin: 241.17011.2-IJ

Related report: https://youtrack.jetbrains.com/issue/IDEA-353282/Java-21-syntax-is-no-longer-supported

@rsmckinney rsmckinney changed the title Manifold is incompatible with Java 21 when clause not working with JDK 21 May 10, 2024
rsmckinney added a commit that referenced this issue May 10, 2024
- update statement parser to handle 'when' switch expression clause
@ice1000
Copy link
Contributor Author

ice1000 commented May 10, 2024

@rsmckinney Does this also fix parsing of other new language features? Such as string interpolation and stuffs

@rsmckinney
Copy link
Member

Yes, JDK 21 is all covered.

@ice1000
Copy link
Contributor Author

ice1000 commented May 11, 2024

Thank you! Should I close the issue?

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

No branches or pull requests

2 participants