kitakkun/back-in-time-plugin

Private superclass properties may not be back-in-time debuggable in certain conditions

Closed this issue · 2 comments

As I described in #89, private properties in superclasses may not be back-in-time debuggable.

For example,

@BackInTime
open class A {
    private var prop: Int = 0
}

@BackInTime
class B {
    var prop: Int = 0 // this is valid because B can't see A.prop
}

In this case, the back-in-time-compiler generates the method for class B like below:

@BackInTime
class B : BackInTimeDebuggable {
    var prop: Int = 0 // this is valid because B can't see A.prop

    override fun forceSetValue(propertyName: String, value: Any?) {
        when (propertyName) {
            "prop" -> prop = value
            else -> super.forceSetValue(propertyName, value)
        }
    }
}

So, logically we can't rewind the state of the prop in class A via class B.
We need to investigate if this problem exists or not, and then fix this potential issue.

To fix this problem, we need to add classFqName to each methods declared in BackInTimeDebuggable interface.

As I examined in this commit, the expected problem has been confirmed.

So, I renamed propertyName to propertyFqName which contains the parent class's full-qualified name, and then fixed the internal compiler logic in #96.

Now this problem should be fixed.