Support filed breakpoints on properties without backing fields

This commit is contained in:
Natalia Ukhorskaya
2015-06-08 12:53:45 +03:00
parent 1c135e7ac7
commit 32d0057a7f
7 changed files with 380 additions and 16 deletions
@@ -0,0 +1,83 @@
package fwAbstractProperty
// Breakpoint at getter/setter
abstract class MyAbstractClass {
//FieldWatchpoint! (propVal)
abstract val propVal: Int
//FieldWatchpoint! (propVar)
abstract var propVar: Int
fun testPropertyInAbstractClass() {
propVal
propVar
propVar = 2
}
}
class MyAbstractClassImpl : MyAbstractClass() {
override val propVal = 1
override var propVar = 1
fun testPropertyInAbstractClassImpl() {
propVal
propVar
propVar = 2
}
}
abstract class MyAbstractClassWithoutBreakpoints {
abstract val propVal2: Int
abstract var propVar2: Int
fun testPropertyInAbstractClass() {
propVal2
propVar2
propVar2 = 2
}
}
// Breakpoint at GETFILED/PUTFIELD
class MyAbstractClassImplWithBreakpoints : MyAbstractClassWithoutBreakpoints() {
//FieldWatchpoint! (propVal2)
override val propVal2 = 1
//FieldWatchpoint! (propVar2)
override var propVar2 = 1
fun testPropertyInAbstractClassImpl() {
propVal2
propVar2
propVar2 = 2
}
}
fun main(args: Array<String>) {
val mac = object: MyAbstractClass() {
override val propVal: Int get() = 1
override var propVar: Int
get() = 1
set(value) {
}
}
mac.testPropertyInAbstractClass()
val maci = MyAbstractClassImpl()
maci.testPropertyInAbstractClass()
maci.testPropertyInAbstractClassImpl()
val macwb = object: MyAbstractClassWithoutBreakpoints() {
override val propVal2: Int get() = 1
override var propVar2: Int
get() = 1
set(value) {
}
}
macwb.testPropertyInAbstractClass()
val macwbi = MyAbstractClassImplWithBreakpoints()
macwbi.testPropertyInAbstractClass()
macwbi.testPropertyInAbstractClassImpl()
}
// RESUME: 17
@@ -0,0 +1,83 @@
package fwPropertyInInterface
// Breakpoint at getter/setter
interface MyInterface {
//FieldWatchpoint! (propVal)
val propVal: Int
//FieldWatchpoint! (propVar)
var propVar: Int
fun testPropertyInInterface() {
propVal
propVar
propVar = 2
}
}
class MyInterfaceImpl : MyInterface {
override val propVal = 1
override var propVar = 1
fun testPropertyInInterfaceImpl() {
propVal
propVar
propVar = 2
}
}
interface MyInterfaceWithoutBreakpoints {
val propVal2: Int
var propVar2: Int
fun testPropertyInInterface() {
propVal2
propVar2
propVar2 = 2
}
}
// Breakpoint at GETFILED/PUTFIELD
class MyInterfaceImplWithBreakpoints : MyInterfaceWithoutBreakpoints {
//FieldWatchpoint! (propVal2)
override val propVal2 = 1
//FieldWatchpoint! (propVar2)
override var propVar2 = 1
fun testPropertyInInterfaceImpl() {
propVal2
propVar2
propVar2 = 2
}
}
fun main(args: Array<String>) {
val mac = object: MyInterface {
override val propVal: Int get() = 1
override var propVar: Int
get() = 1
set(value) {
}
}
mac.testPropertyInInterface()
val maci = MyInterfaceImpl()
maci.testPropertyInInterface()
maci.testPropertyInInterfaceImpl()
val macwb = object: MyInterfaceWithoutBreakpoints {
override val propVal2: Int get() = 1
override var propVar2: Int
get() = 1
set(value) {
}
}
macwb.testPropertyInInterface()
val macwbi = MyInterfaceImplWithBreakpoints()
macwbi.testPropertyInInterface()
macwbi.testPropertyInInterfaceImpl()
}
// RESUME: 17
@@ -1,15 +1,5 @@
package inapplicableFieldWatchpoints
class A {
//FieldWatchpoint! (propWithGet)
val propWithGet: Int get() = 1
}
interface T {
//FieldWatchpoint! (propInInterface)
val propInInterface: Int
}
fun main(args: Array<String>) {
//FieldWatchpoint! (localVal)
val localVal = 1