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

Sad sad panda error with nested sealed interfaces #533

Closed
nathan818fr opened this issue Apr 9, 2022 · 2 comments · Fixed by #538
Closed

Sad sad panda error with nested sealed interfaces #533

nathan818fr opened this issue Apr 9, 2022 · 2 comments · Fixed by #538
Labels
area: bug 🐛 Something isn't working $$ bug-bounty $$ https://www.jhipster.tech/bug-bounties/ $100 https://www.jhipster.tech/bug-bounties/

Comments

@nathan818fr
Copy link

Prettier-Java 1.6.1

Like #522 but for inner-interfaces.

Input:

package hello;

public interface Test {
    sealed interface Inner {}
}

Output:

[error] Test.java: Error: Sad sad panda, parsing errors detected in line: 4, column: 5!
[error] Expecting: one of these possible Token sequences:
[error]   1. ['@']
[error]   2. ['public']
[error]   3. ['static']
[error]   4. ['final']
[error]   5. ['byte']
[error]   6. ['short']
[error]   7. ['int']
[error]   8. ['long']
[error]   9. ['char']
[error]   10. ['float']
[error]   11. ['double']
[error]   12. ['boolean']
[error]   13. [Identifier]
[error]   14. ['@']
[error]   15. ['public']
[error]   16. ['private']
[error]   17. ['abstract']
[error]   18. ['default']
[error]   19. ['static']
[error]   20. ['strictfp']
[error]   21. ['<']
[error]   22. ['byte']
[error]   23. ['short']
[error]   24. ['int']
[error]   25. ['long']
[error]   26. ['char']
[error]   27. ['float']
[error]   28. ['double']
[error]   29. ['boolean']
[error]   30. [Identifier]
[error]   31. ['void']
[error]   32. ['@']
[error]   33. ['public']
[error]   34. ['protected']
[error]   35. ['private']
[error]   36. ['abstract']
[error]   37. ['static']
[error]   38. ['final']
[error]   39. ['sealed']
[error]   40. ['non-sealed']
[error]   41. ['strictfp']
[error]   42. ['class']
[error]   43. ['enum']
[error]   44. ['record']
[error]   45. ['@']
[error]   46. ['public']
[error]   47. ['protected']
[error]   48. ['private']
[error]   49. ['abstract']
[error]   50. ['static']
[error]   51. ['sealed']
[error]   52. ['non-sealed']
[error]   53. ['strictfp']
[error]   54. ['interface']
[error]   55. [';']
[error] but found: 'sealed'!
[error]         ->compilationUnit
[error]         ->ordinaryCompilationUnit
[error]         ->typeDeclaration
[error]         ->interfaceDeclaration
[error]         ->normalInterfaceDeclaration
[error]         ->interfaceBody
[error]         ->interfaceMemberDeclaration
[error]     at Object.parse (/xxx/node_modules/java-parser/src/index.js:41:11)
[error]     at Object.parse (/xxx/node_modules/prettier-plugin-java/dist/parser.js:4:26)
[error]     at Object.parse (/xxx/node_modules/prettier/index.js:7361:23)
[error]     at coreFormat (/xxx/node_modules/prettier/index.js:8672:18)
[error]     at formatWithCursor2 (/xxx/node_modules/prettier/index.js:8864:18)
[error]     at Object.formatWithCursor (/xxx/node_modules/prettier/index.js:39174:12)
[error]     at format (/xxx/node_modules/prettier/cli.js:12043:24)
[error]     at formatFiles2 (/xxx/node_modules/prettier/cli.js:12122:20)
[error]     at async main (/xxx/node_modules/prettier/cli.js:12327:5)
[error]     at async Object.run (/xxx/node_modules/prettier/cli.js:12274:5)

Expected behavior:
No error and properly formatted file

@clementdessoude
Copy link
Contributor

Hi @nathan818fr !

Thank you for reporting this, and sorry for the delay ! #523 fixed the issue for nested sealed classes in class body declarations, but I forgot to update interface declarations as well :/

#538 should fix this !

@clementdessoude clementdessoude added the area: bug 🐛 Something isn't working label May 22, 2022
@pascalgrimaud pascalgrimaud added $100 https://www.jhipster.tech/bug-bounties/ $$ bug-bounty $$ https://www.jhipster.tech/bug-bounties/ labels May 25, 2022
@pascalgrimaud
Copy link
Member

adding a bounty as it's a bug, which needs to be fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: bug 🐛 Something isn't working $$ bug-bounty $$ https://www.jhipster.tech/bug-bounties/ $100 https://www.jhipster.tech/bug-bounties/
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants