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

Error on unnamed variable (JDK 21 Preview) #978

Closed
bdeneuter opened this issue Oct 19, 2023 · 0 comments · Fixed by #1001
Closed

Error on unnamed variable (JDK 21 Preview) #978

bdeneuter opened this issue Oct 19, 2023 · 0 comments · Fixed by #1001
Labels

Comments

@bdeneuter
Copy link

Unnamed variables have been added to JDK 21 as a preview feature (https://openjdk.org/jeps/443). When formatting the source code with an unnamed variable, google-java-format throws an exception.

Caused by: com.google.googlejavaformat.java.FormatterException: 102:8: error: expected token: '_'; generated  instead
        at com.google.googlejavaformat.java.Formatter.getFormatReplacements(Formatter.java:275)
        at com.google.googlejavaformat.java.Formatter.formatSource(Formatter.java:247)
        at com.google.googlejavaformat.java.Formatter.formatSource(Formatter.java:213)
        at java.base@21.0.1/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
        ... 169 more
@cushon cushon added the Java 21 label Dec 7, 2023
copybara-service bot pushed a commit that referenced this issue Dec 8, 2023
Fixes #978

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

Successfully merging a pull request may close this issue.

2 participants