Skip to content

Can't access delegate in bridge component #86

@joemasilotti

Description

@joemasilotti

I've copy-pasted the following into an existing Hotwire Native Android app from the Bridge Components section of the guide.

package com.masilotti.hikingjournal.components

import androidx.fragment.app.Fragment
import dev.hotwire.core.bridge.BridgeComponent
import dev.hotwire.core.bridge.BridgeDelegate
import dev.hotwire.core.bridge.Message
import dev.hotwire.navigation.destinations.HotwireDestination

class ButtonComponent(
    name: String,
    private val delegate: BridgeDelegate<HotwireDestination>
) : BridgeComponent<HotwireDestination>(name, delegate) {
    private val fragment: Fragment
        get() = delegate.destination.fragment

    override fun onReceive(message: Message) {
        TODO("Not yet implemented")
    }
}

When I try to run the app it fails with the following error:

e: file://app/src/main/java/com/masilotti/hikingjournal/components/ButtonComponent.kt:9:7 Conflicting declarations:
val delegate: BridgeDelegate<HotwireDestination>

If I change private val delegate to delegate then I get the following error:

e: file:///app/src/main/java/com/masilotti/hikingjournal/components/ButtonComponent.kt:14:17 Cannot access 'val delegate: BridgeDelegate<HotwireDestination>':
it is private/*private to this*/ in 'com/masilotti/hikingjournal/components/ButtonComponent'.

I'm extra confused because if I copy paste this into a brand new Hotwire Native app I don't get the error. Same goes for the demo app.

Any ideas what could be causing this? I'm at a loss as to what I could have configured, or dependency I added, to change something so fundamental about Kotlin. I'm using Hotwire Native Android v1.1.1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions