Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
dbacinski opened this issue Oct 2, 2024 · 0 comments

Comments

@dbacinski
Copy link

dbacinski commented Oct 2, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant