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 classes #522

Closed
jqno opened this issue Jan 4, 2022 · 7 comments · Fixed by #523
Closed

Sad sad panda error with nested sealed classes #522

jqno opened this issue Jan 4, 2022 · 7 comments · Fixed by #523
Labels
area: bug 🐛 Something isn't working $$ bug-bounty $$ https://www.jhipster.tech/bug-bounties/ $100 https://www.jhipster.tech/bug-bounties/

Comments

@jqno
Copy link

jqno commented Jan 4, 2022

Prettier-Java 1.6.0

I have a class that contains a static sealed class and its static subclasses. When I try to format it, I get a Sad sad panda error.

# .prettierrc:
tabWidth: 4
printWidth: 100
trailingComma: "none"

Input:

package nl.jqno.equalsverifier.integration.extended_contract;

public class SealedClasses {
    public static sealed abstract class SealedParent permits SealedChild {}

    final static class SealedChild extends SealedParent {}
}

Output:

unchanged, but got this error:

└─❯ prettier SealedClasses.java
SealedClasses.java[error] SealedClasses.java: Error: Sad sad panda, parsing errors detected in line: 4, column: 12!
[error] Expecting token of type --> Identifier <-- but found --> 'static' <--!
[error] 	->compilationUnit
[error] 	->ordinaryCompilationUnit
[error] 	->typeDeclaration
[error] 	->classDeclaration
[error] 	->normalClassDeclaration
[error] 	->classBody
[error] 	->classBodyDeclaration
[error] 	->constructorDeclaration
[error] 	->constructorDeclarator
[error] 	->simpleTypeName
[error]     at Object.parse (/home/jqno/.npm-global/lib/node_modules/prettier-plugin-java/node_modules/java-parser/src/index.js:41:11)
[error]     at Object.parse (/home/jqno/.npm-global/lib/node_modules/prettier-plugin-java/src/parser.js:6:26)
[error]     at Object.parse$a [as parse] (/home/jqno/.npm-global/lib/node_modules/prettier/index.js:13684:19)
[error]     at coreFormat (/home/jqno/.npm-global/lib/node_modules/prettier/index.js:15215:16)
[error]     at formatWithCursor$1 (/home/jqno/.npm-global/lib/node_modules/prettier/index.js:15455:14)
[error]     at Object.formatWithCursor (/home/jqno/.npm-global/lib/node_modules/prettier/index.js:60228:12)
[error]     at format$1 (/home/jqno/.npm-global/lib/node_modules/prettier/bin-prettier.js:16827:21)
[error]     at Object.formatFiles$1 [as formatFiles] (/home/jqno/.npm-global/lib/node_modules/prettier/bin-prettier.js:16941:16)
[error]     at async main (/home/jqno/.npm-global/lib/node_modules/prettier/bin-prettier.js:18802:5)
[error]     at async Object.run (/home/jqno/.npm-global/lib/node_modules/prettier/bin-prettier.js:18745:5)

Expected behavior:

No error and properly formatted file

@clementdessoude
Copy link
Contributor

Thanks for submitting this issue @jqno. #523 should fix it hopefully !

@jqno
Copy link
Author

jqno commented Jan 5, 2022

Awesome, thanks! I eagerly await the release 😄

@pascalgrimaud pascalgrimaud added $$ bug-bounty $$ https://www.jhipster.tech/bug-bounties/ $100 https://www.jhipster.tech/bug-bounties/ area: bug 🐛 Something isn't working labels Jan 5, 2022
@pascalgrimaud
Copy link
Member

adding a bounty as it's a bug
should be cool to have it in next release :)

@clementdessoude
Copy link
Contributor

Hi there ! I just released the 1.6.1 version. Can you test it @jqno and tell me if the bug is fixed ?

@jqno
Copy link
Author

jqno commented Jan 6, 2022

Confirmed, it works! Thanks for the quick turnaround!

@clementdessoude
Copy link
Contributor

@pascalgrimaud
Copy link
Member

@clementdessoude : approved

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