Skip to content

Compilation error for too big layout java.io.FileNotFoundException / Method too large #289

@dbacinski

Description

@dbacinski

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions