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

Cannot extend Kotlin DSL #374

Open
bmorris591 opened this issue Jul 23, 2021 · 1 comment
Open

Cannot extend Kotlin DSL #374

bmorris591 opened this issue Jul 23, 2021 · 1 comment

Comments

@bmorris591
Copy link

bmorris591 commented Jul 23, 2021

With reference to #275 and #253

I am trying to create a simple extension to enable using r2bdc-migrate, my starting point it

class R2dbcMigrationDsl(private val init: R2dbcMigrationDsl.() -> Unit) : AbstractDsl() {

    override fun initialize(context: GenericApplicationContext) {
        super.initialize(context)
        init()

        val properties = r2dbcMigrationProperties()

        R2dbcMigrationInitialiser(properties).initialize(context)
    }

    fun r2dbcMigrationProperties(): R2dbcMigrateProperties =
        let { self ->
            R2dbcMigrateProperties().apply {

            }
        }
}

fun R2dbcDsl.migrate(dsl: R2dbcMigrationDsl.() -> Unit = {}) {
    R2dbcMigrationDsl(dsl).initialize(context)
}

I have a compilation error at .initialize(context) because context is internal.

snip/migrate/R2dbcMigrationDsl.kt:29:39
Kotlin: Cannot access 'context': it is internal in 'R2dbcDsl'

I think the context needs to become more visible to allow for DSLs to extend and use the idiom that Kofu uses.

@Julien-Eyraud
Copy link

there is a much larger issue to improve extensibility of Kofu/Jafu #360

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

2 participants