question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Diktat crashes when lambda expression only contains a comment.

See original GitHub issue

Describe the bug

Diktat does not correctly handle lambda expressions that only contain a comment.

Expected behavior

This code:

var list = listOf("a", "b", "c")
list.forEach { /* test */ }

should result in the following error:

[EMPTY_BLOCK_STRUCTURE_ERROR] incorrect format of empty block: empty blocks are forbidden unless it is function with override keyword (cannot be auto-corrected)

Observed behavior

Gradle gives the following error:

java.lang.Error: Internal error in diktat application
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private transient java.lang.Object java.lang.Throwable.backtrace accessible: module java.base does not "opens java.lang" to unnamed module @647c3190

Steps to Reproduce

  1. Create a new Kotlin project
  2. Add the following code:
fun main() {
    var list = listOf("a", "b", "c")
    list.forEach { /* test */ }
}
  1. Run diktat

Environment information

  • diktat version: 0.43.0 (gradle plugin version 1.0.1)
  • build tool (maven/gradle): gradle
  • how is diktat run (CLI, plugin, etc.): Command line “./gradlew diktatCheck”
  • kotlin version: 1.6.10
  • operating system: macOS Monterey version 12.1
  • link to a project (if your project is public):

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
akuleshov7commented, Jan 12, 2022

@JamesBundgard I had mostly the same issue, but it looks that we need to wait for some updates from JB

0reactions
JamesBundgardcommented, Jan 12, 2022

@akuleshov7 I’ve also had a lot of issues getting docker running

Read more comments on GitHub >

github_iconTop Results From Across the Web

Diktat not working on new MAC M1 processors with JDK17 · Issue ...
Please make an issue on this bug at https://github.com/cqfn/diKTat/. ... Diktat crashes when lambda expression only contains a comment. #1169.
Read more >
Lint crashes when using lambda expressions with retrolambda
One of the comments in the issue mentions that lint never actually worked with retrolambda but rather, with the newest lint version, is...
Read more >
Beyond Exception Handling with Control Flow Mechanisms
From this behavior, we can induce that this lambda function has access to a certain implicit state. Where the lexical variable x has...
Read more >
The Serverless Revolution Has Stalled | Hacker News
I view the serverless, specifically aws lambda, as nice way to hook into the aws system and add some code to handle certain...
Read more >
It is painful to see that a large portion of our industry hasn't ...
I think a lot of the blame has to lie with tutorial and reference websites that inexplicably get great search rankings but have...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found