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

ClassCastException in IndentationRule when blank line is added after @implNote tag in KDoc #480

Closed
petertrr opened this issue Nov 2, 2020 · 1 comment · Fixed by #527
Assignees
Labels
bug Something isn't working

Comments

@petertrr
Copy link
Member

petertrr commented Nov 2, 2020

Describe the bug

class Foo {
    /**
     * @implNote lorem ipsum
     */
    private fun foo() {}
}

crashes diktat, but with one empty line (* ) after implNote - it doesn't. Problem is, most probably, in how KdocFormatting adds empty lines.

Observed behavior

Caused by: java.lang.ClassCastException: class org.jetbrains.kotlin.com.intellij.psi.impl.source.tree.LeafPsiElement cannot be cast to class org.jetbrains.kotlin.com.intellij.psi.PsiWhiteSpace (org.jetbrains.kotlin.com.intellij.psi.impl.source.tree.LeafPsiElement and org.jetbrains.kotlin.com.intellij.psi.PsiWhiteSpace are in unnamed module of loader org.codehaus.plexus.classworlds.realm.ClassRealm @7a639ec5)
    at org.cqfn.diktat.ruleset.rules.files.IndentationRule.visitWhiteSpace (IndentationRule.kt:165)
    at org.cqfn.diktat.ruleset.rules.files.IndentationRule.access$visitWhiteSpace (IndentationRule.kt:57)
    at org.cqfn.diktat.ruleset.rules.files.IndentationRule$checkIndentation$1.invoke (IndentationRule.kt:156)
    at org.cqfn.diktat.ruleset.rules.files.IndentationRule$checkIndentation$1.invoke (IndentationRule.kt:57)

Environment information

  • diktat version: 0.1.3
  • build tool (maven/gradle): maven
  • how is diktat run (CLI, plugin, etc.): plugin
  • kotlin version: 1.4.10
@petertrr petertrr added the bug Something isn't working label Nov 2, 2020
@petertrr
Copy link
Member Author

petertrr commented Nov 2, 2020

Also, it shouldn't be trying to insert an empty line if there is no more text after tag's body.

@aktsay6 aktsay6 self-assigned this Nov 16, 2020
aktsay6 added a commit that referenced this issue Nov 16, 2020
### What's done:
  * Fixed bugs
aktsay6 added a commit that referenced this issue Nov 16, 2020
### What's done:
  * Fixed bugs
aktsay6 added a commit that referenced this issue Nov 16, 2020
### What's done:
  * test diktat snapshot (action)
aktsay6 added a commit that referenced this issue Nov 16, 2020
### What's done:
  * test diktat snapshot (action)
aktsay6 added a commit that referenced this issue Nov 16, 2020
### What's done:
  * test diktat snapshot (action)
aktsay6 added a commit that referenced this issue Nov 16, 2020
### What's done:
  * test diktat snapshot (action)
aktsay6 added a commit that referenced this issue Nov 16, 2020
### What's done:
  * Fixed bugs
aktsay6 added a commit that referenced this issue Nov 19, 2020
### What's done:
  * Fixed bugs
aktsay6 added a commit that referenced this issue Nov 19, 2020
# Conflicts:
#	diktat-rules/src/test/resources/test/smoke/src/main/kotlin/Example3Expected.kt
#	diktat-rules/src/test/resources/test/smoke/src/main/kotlin/Example3Test.kt
aktsay6 added a commit that referenced this issue Nov 20, 2020
### What's done:
  * Fixed bugs
aktsay6 added a commit that referenced this issue Nov 23, 2020
…d after @implNote tag in KDoc (#527)

* bugfix/class-cast-exception-kdoc(#480)
### What's done:
  * Fixed bugs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants