google/google-java-format

Format failed with instructions to raise a bug...

big-andy-coates opened this issue · 2 comments

Raising as requested :)

msg.txt

FYI, changing:

"""
UPDATE %s SET varchar_col = 'bar', timestamp_col = '2009-01-03T02:54:25.001';
INSERT INTO %s (varchar_col, timestamp_col) VALUES ( 'car','2017-08-24T01:57:37.000')"""

To:

"""
UPDATE %s SET varchar_col = 'bar', timestamp_col = '2009-01-03T02:54:25.001';
INSERT INTO %s (varchar_col, timestamp_col) VALUES ( 'car','2017-08-24T01:57:37.000')
"""

Resolved the issue...

Gradle config:

plugins {
    id 'com.diffplug.spotless' version "6.22.0"
    ...
}

  spotless {
      java {
          googleJavaFormat("1.15.0").aosp().reflowLongStrings()
          indentWithSpaces()
          importOrder()
          removeUnusedImports()
          trimTrailingWhitespace()
          endWithNewline()
          toggleOffOn("formatting:off", "formatting:on")
          targetExclude("**/build/generated/source*/**/*.*")
      }
  }

Fwiw, the message also says:

google-java-format 1.15.0 is currently being used, but outdated.
google-java-format 1.17.0 is the recommended version, which may have fixed this problem.
google-java-format 1.17.0 requires JVM 11+.

and the latest GJF version is 1.24.0 (and text block support has been improved a couple times in the last few versions)

So maybe just use the latest version?

Thanks for passing the crash report along. Can you try using the latest version as tbroyer suggested? If you're still seeing a crash, please re-open and include the original input that the formatter is crashing on.