gammax
03/15/2021, 11:54 AMyschimke
03/15/2021, 12:57 PMgammax
03/15/2021, 1:04 PMrtsketo
03/15/2021, 6:49 PMExecution failed for task ':core:ktfmtFormatMainJavaSource'.
> 132:46: error: did not generate token ";"
What am I doing wrong?gammax
03/15/2021, 6:51 PMSorry for newbie question here.You should not be sorry for asking 🙏 Seems like a bug, potentially in #ktfmt rather than the gradle plugin 🧐 Could you open an issue (if you could also provide the file where it’s failing that would be awesome)
rtsketo
03/15/2021, 6:57 PMgammax
03/15/2021, 7:01 PM--info
the tool prints out what is doing.rtsketo
03/15/2021, 7:30 PM> Task :core:ktfmtFormatMainJavaSource
Caching disabled for task ':core:ktfmtFormatMainJavaSource' because:
Build cache is disabled
Task ':core:ktfmtFormatMainJavaSource' is not up-to-date because:
Task has failed previously.
> Task :core:ktfmtFormatMainJavaSource FAILED
:core:ktfmtFormatMainJavaSource (Thread[Daemon worker,5,main]) completed. Took 12.826 secs.
Execution failed for task ':core:ktfmtFormatMainJavaSource'.
> 132:46: error: did not generate token ";"
With `--stacktrace`: https://pastebin.com/Jk3hHk50Step 'ktfmt' found problem in 'app\src\main\java\-someting-\main\fragment\home\account\cards\CardAdapter.kt':
32:45: error: did not generate token ";"
So it turns out, it can't handle a ;
in a when, for example (changed names):
icon.setImageResource(when (issuerID) {
"Something1" -> something1; "Something2" -> somethings2
"" -> something3.also { \* some other code in here *\ }
else -> something4
})
gammax
03/15/2021, 8:38 PM;
issue upstream here. That needs to be addressed by ktfmt maintainers.
• I’ve fixed the error message as when ktfmt was crashing, the gradle plugin was not reporting on which file failed. That’s merged herertsketo
03/17/2021, 1:06 PMCarmi Grushko
03/19/2021, 5:27 PMgammax
03/20/2021, 3:47 PM