kotlinx.html
kotlinx.html copied to clipboard
Compilation error for too big layout java.io.FileNotFoundException / Method too large
trafficstars
I have a very big layout and compilation fails with:
Caused by: java.io.FileNotFoundException: /projectl/build/classes/kotlin/main/com/example/OrderViewKt.class (No such file or directory)
exception: java.lang.RuntimeException: Error generating class file com/example//OrderViewKt.class (compiled from [/kotlin/adminPortal/src/main/kotlin/gt/kemik/adminPortal/orders/orderView.kt]): Method too large: com/example/OrderViewKt.orderView
the way to workaround it is to extract parts of layout to extension function
fun orderView(){
return "<!DOCTYPE html>\n" + createHTML().html {
head {
title { +"1234" }
}
body {
//...
coupons()
//...
}
}
fun FlowContent.coupons() {
h3(classes = "subtitle is-3") {
+"Cupón"
}
}
Would be great to document is somewhere.