hello, is this a known issue? I have an interface ...
# kapt
d
hello, is this a known issue? I have an interface
Copy code
interface AutoRefreshViewModel : LifecycleObserver {

    @OnLifecycleEvent(value = Lifecycle.Event.ON_START)
    fun startAutoRefresh()

    @OnLifecycleEvent(value = Lifecycle.Event.ON_STOP)
    fun stopAutoRefresh()
}
and then I have implementation of this interface
Copy code
class AutoRefreshImplementation(val period: Long, val action: () -> Unit) : AutoRefreshViewModel {
    private var refreshDisposable: Disposable? = null

    override fun startAutoRefresh() {
        refreshDisposable?.safeDispose()
        refreshDisposable = Observable.interval(period, period, TimeUnit.MILLISECONDS)
                .subscribe {
                    action()
                }
    }

    override fun stopAutoRefresh() {
        refreshDisposable?.safeDispose()
    }
}
usage of it in class is simple,
Copy code
class ControlViewModel @Inject constructor() : ViewModel(), AutoRefreshViewModel by AutoRefreshImplementation(period, {
// action 
}) {...}
everything works fine until I change something in this file
ControlViewModel
, then annotation processor throws an error
Copy code
ControlViewModel.java:52: error: annotation @OnLifecycleEvent is missing a default value for the element 'value'
    @android.arch.lifecycle.OnLifecycleEvent()
and in the generated stub I can see both methods as
Copy code
@java.lang.Override()
    @android.arch.lifecycle.OnLifecycleEvent()
    public void startAutoRefresh() {
    }
    
    @java.lang.Override()
    @android.arch.lifecycle.OnLifecycleEvent()
    public void stopAutoRefresh() {
    }
… if I rebuild my project, stub looks ok
Copy code
@java.lang.Override()
    @android.arch.lifecycle.OnLifecycleEvent(value = android.arch.lifecycle.Lifecycle.Event.ON_START)
    public void startAutoRefresh() {
    }
    
    @java.lang.Override()
    @android.arch.lifecycle.OnLifecycleEvent(value = android.arch.lifecycle.Lifecycle.Event.ON_STOP)
    public void stopAutoRefresh() {
    }
workaround is to not use delegated implementation but use it myself, but its a real bummer