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.

Crash with synchronized - new in 0.26

See original GitHub issue

This sample code:

class Foo {
  companion object {
    var instance: Foo? = null

    fun getInstance() {
      return instance ?: synchronized(Foo::class) {
        Foo().also { instance = it }
      }
    }
  }
}

crashes the formatter with

error: did not generate token "("
com.google.googlejavaformat.FormattingError: 9:51: error: did not generate token "("

        at com.google.googlejavaformat.OpsBuilder.sync(OpsBuilder.java:231)
        at com.facebook.ktfmt.KotlinInputAstVisitorBase.sync(KotlinInputAstVisitorBase.kt:2298)
        at com.facebook.ktfmt.KotlinInputAstVisitorBase.visitLambdaExpression(KotlinInputAstVisitorBase.kt:806)
 ...

The formatter handled this fine in 0.25.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
steventroublecommented, Jun 23, 2021

Example pull request here that I think should fix the issue, but I won’t be able to test it for regressions on real code until tomorrow or possibly later this week: https://github.com/facebookincubator/ktfmt/pull/244

0reactions
steventroublecommented, Jun 28, 2021

SG, thanks Carmi!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Itunes crashes on Synch - Apple Support Communities
The computer is about 6 months old, so still relatively new. On the computer, I am running Itunes Version 12.11.0.26.
Read more >
Snap sync crash #22172 - ethereum/go-ethereum - GitHub
System information Geth version: running this PR: #22171 Backtrace Jan 14 15:28:42 mon02.ethdevops.io geth ERROR[01-14|14:28:42.822] Failed ...
Read more >
Release Notes | Mimestream
(macOS 13) Crash when accessing contacts without authorization ... New messages with no labels don't sync via push; Already-open compose ... Version 0.26.2....
Read more >
Publii hotfix 0.26.1 released; squashes bugs and improves navigation
Improved behaviour of "Cancel" button on the "Add new website" view. Added clear button to the Site Switcher search bar. Changed sync button...
Read more >
The New Version 0.26.12 | The Welkin Suite
This new version includes a lot of changes related to the custom folder structure synchronization, the build process, work with test results and...
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