Sad sad panda error with nested sealed classes
See original GitHub issuePrettier-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
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
Support for nested sealed classes? · Issue #117 - GitHub
Hi, I'm trying to migrate to moshi.sealed but this I'm not sure if is supported @JsonClass(generateAdapter = true, ...
Read more >Accessing the nested level of sealed class in android kotlin
I call the sealed class sendTheEventEvent(MyEvents.HelloBroadcasting.FeatureSegments.SegmentationChapterNameClicked(mContext,it.
Read more >News Altona Gnk - Gentle Monster
C# base class for an anonymous type, Dreitagebart model, Kmjk computrabajo, ... Serum tryptase angioedema, Sell non op car, Vladimir bogdanovic novi sad, ......
Read more >D'oh!! There is no copy method for Sealed Classes in Kotlin!
A few weeks ago we looked at one of my pain points of working with Kotlin Data Classes: nested copy and we improved...
Read more >A base class for custom WPF binding markup extensions
And failed because BindingBase.ProvideValue is sealed? Me too… The result is a MarkupExtension that works around the issue that you cannot ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Confirmed, it works! Thanks for the quick turnaround!
@clementdessoude : approved