New IC: Include inline property accessors in class/package members

Problem: ClasspathChangesComputer (a core component of the new IC) uses
the existing inline function analysis from the old IC
(IncrementalJvmCache.InlineFunctionsMap). If an inline property accessor
has changed, the inline function analysis will report the name of the
property accessor, not the name of the property.
ClasspathChangesComputer doesn't see the property accessor's name in the
list of class/package members, so it will throw an exception.

Solution: There are 2 options:
  1. If an inline property accessor has changed, the inline function
     analysis can report the name of the property instead of the
     property accessor.
  2. ClasspathChangesComputer can include property accessors in the list
     of class/package members.

In this commit, we will choose option 2 as it is simpler.

Test: New KotlinOnlyClasspathChangesComputerTest.testPropertyAccessors

Small cleanup - PLS SQUASH INTO PREVIOUS COMMIT

  - Address review
  - Fix failed tests
  - Add some trivial changes

^KT-53871 Fixed
This commit is contained in:
Hung Nguyen
2022-09-04 15:39:32 +01:00
committed by nataliya.valtman
parent 2ba7c7b8a9
commit 03f83ff339
23 changed files with 376 additions and 126 deletions
@@ -14,6 +14,8 @@ class SomeClass {
inline fun inlineFunctionChangedSignature(): Long = 0
inline fun inlineFunctionChangedImplementation(): Int = 1000
inline fun inlineFunctionChangedLineNumber(): Int = 0
inline fun inlineFunctionChangedUnchanged(): Int = 0
private inline fun privateInlineFunctionChangedSignature(): Long = 0
}
@@ -14,6 +14,8 @@ class SomeClass {
inline fun inlineFunctionChangedSignature(): Int = 0
inline fun inlineFunctionChangedImplementation(): Int = 0
inline fun inlineFunctionChangedLineNumber(): Int = 0
inline fun inlineFunctionChangedUnchanged(): Int = 0
private inline fun privateInlineFunctionChangedSignature(): Int = 0
}
@@ -0,0 +1,79 @@
package com.example
@Suppress("RedundantGetter", "RedundantSetter")
class SomeClass {
var property_ChangedType: Long = 0
get() = field
set(value) {
field = value
}
var property_ChangedGetterImpl: Int = 0
get() {
println("Getter implementation has changed!")
return field
}
set(value) {
field = value
}
var property_ChangedSetterImpl: Int = 0
get() = field
set(value) {
println("Setter implementation has changed!")
field = value
}
var property_Unchanged: Int = 0
get() = field
set(value) {
field = value
}
private var privateProperty_ChangedType: Long = 0
get() = field
set(value) {
field = value
}
}
var inlineProperty_ChangedType_BackingField: Long = 0
var inlineProperty_ChangedGetterImpl_BackingField: Int = 0
var inlineProperty_ChangedSetterImpl_BackingField: Int = 0
var inlineProperty_Unchanged_BackingField: Int = 0
private var privateInlineProperty_ChangedType_BackingField: Long = 0
inline var inlineProperty_ChangedType: Long
get() = inlineProperty_ChangedType_BackingField
set(value) {
inlineProperty_ChangedType_BackingField = value
}
inline var inlineProperty_ChangedGetterImpl: Int
get() {
println("Getter implementation has changed!")
return inlineProperty_ChangedGetterImpl_BackingField
}
set(value) {
inlineProperty_ChangedGetterImpl_BackingField = value
}
inline var inlineProperty_ChangedSetterImpl: Int
get() = inlineProperty_ChangedSetterImpl_BackingField
set(value) {
println("Setter implementation has changed!")
inlineProperty_ChangedSetterImpl_BackingField = value
}
inline var inlineProperty_Unchanged: Int
get() = inlineProperty_Unchanged_BackingField
set(value) {
inlineProperty_Unchanged_BackingField = value
}
private inline var privateInlineProperty_ChangedType: Long
get() = privateInlineProperty_ChangedType_BackingField
set(value) {
privateInlineProperty_ChangedType_BackingField = value
}
@@ -0,0 +1,79 @@
package com.example
@Suppress("RedundantGetter", "RedundantSetter")
class SomeClass {
var property_ChangedType: Int = 0
get() = field
set(value) {
field = value
}
var property_ChangedGetterImpl: Int = 0
get() {
println("Getter implementation")
return field
}
set(value) {
field = value
}
var property_ChangedSetterImpl: Int = 0
get() = field
set(value) {
println("Setter implementation")
field = value
}
var property_Unchanged: Int = 0
get() = field
set(value) {
field = value
}
private var privateProperty_ChangedType: Int = 0
get() = field
set(value) {
field = value
}
}
var inlineProperty_ChangedType_BackingField: Int = 0
var inlineProperty_ChangedGetterImpl_BackingField: Int = 0
var inlineProperty_ChangedSetterImpl_BackingField: Int = 0
var inlineProperty_Unchanged_BackingField: Int = 0
private var privateInlineProperty_ChangedType_BackingField: Int = 0
inline var inlineProperty_ChangedType: Int
get() = inlineProperty_ChangedType_BackingField
set(value) {
inlineProperty_ChangedType_BackingField = value
}
inline var inlineProperty_ChangedGetterImpl: Int
get() {
println("Getter implementation")
return inlineProperty_ChangedGetterImpl_BackingField
}
set(value) {
inlineProperty_ChangedGetterImpl_BackingField = value
}
inline var inlineProperty_ChangedSetterImpl: Int
get() = inlineProperty_ChangedSetterImpl_BackingField
set(value) {
println("Setter implementation")
inlineProperty_ChangedSetterImpl_BackingField = value
}
inline var inlineProperty_Unchanged: Int
get() = inlineProperty_Unchanged_BackingField
set(value) {
inlineProperty_Unchanged_BackingField = value
}
private inline var privateInlineProperty_ChangedType: Int
get() = privateInlineProperty_ChangedType_BackingField
set(value) {
privateInlineProperty_ChangedType_BackingField = value
}
@@ -44,7 +44,7 @@
"publicFunction"
],
"constantsMap": {},
"inlineFunctionsMap": {},
"inlineFunctionsAndAccessorsMap": {},
"className$delegate": {
"initializer": {},
"_value": {}