Extract KotlinClassInfo to a separate class

to reduce the size of IncrementalJvmCache and prepare for the next
change.

^KT-54144 In progress

Handle changes to inline functions/property accessors with `@JvmName`s

If we detect a change in an inline function `foo` with @JvmName
`fooJvmName`, we have two options:
   1. Report that function `foo` has changed
   2. Report that method `fooJvmName` has changed

Similarly, if we detect a change in an inline property accessor with
JvmName `getFoo` of property `foo`, we have two options:
   1. Report that property `foo` has changed
   2. Report that property accessor `getFoo` has changed

The compiler is guaranteed to generate `LookupSymbol`s corresponding to
option 1 when referencing inline functions/property accessors, but it is
not guaranteed to generate `LookupSymbol`s corresponding to option 2.
(Currently the compiler seems to support option 2 for *inline*
functions/property accessors, but that may change.)

Therefore, we will choose option 1 as it is cleaner and safer.

^KT-54144 In progress

Ignore inline functions that are not found in the bytecode

^KT-54144 In progress

Add unit test for handling `@JvmName`s

Test: KotlinOnlyClasspathChangesComputerTest
             #testFunctionsAndPropertyAccessorsWithJvmNames
^KT-54144 Fixed

Small cleanup in IncrementalCompilerRunner

 - Add comment for closing caches
 - Rename providedChangedFiles to changedFiles
 - Tiny clean up in `performWorkBeforeCompilation`
 - Count directories to delete in debug logs

^KT-53015 In progress

Small cleanup in IncrementalCompilerRunner

 - Add comment for closing caches
 - Rename providedChangedFiles to changedFiles
 - Tiny clean up in `performWorkBeforeCompilation`
 - Count directories to delete in debug logs

^KT-53015 In progress
This commit is contained in:
Hung Nguyen
2022-10-13 19:32:14 +01:00
committed by nataliya.valtman
parent fce8b877c8
commit ec3da62672
19 changed files with 501 additions and 365 deletions
@@ -223,11 +223,9 @@ class KotlinOnlyClasspathChangesComputerTest : ClasspathChangesComputerTest() {
LookupSymbol(name = "inlineProperty_ChangedType", scope = "com.example"),
LookupSymbol(name = "inlineProperty_ChangedType_BackingField", scope = "com.example"),
LookupSymbol(name = "getInlineProperty_ChangedType", scope = "com.example"),
LookupSymbol(name = "setInlineProperty_ChangedType", scope = "com.example"),
LookupSymbol(name = "getInlineProperty_ChangedGetterImpl", scope = "com.example"),
LookupSymbol(name = "setInlineProperty_ChangedSetterImpl", scope = "com.example"),
LookupSymbol(name = "inlineProperty_ChangedGetterImpl", scope = "com.example"),
LookupSymbol(name = "inlineProperty_ChangedSetterImpl", scope = "com.example"),
LookupSymbol(name = SAM_LOOKUP_NAME.asString(), scope = "com.example.SomeClass")
),
@@ -238,6 +236,26 @@ class KotlinOnlyClasspathChangesComputerTest : ClasspathChangesComputerTest() {
).assertEquals(changes)
}
@Test
fun testFunctionsAndPropertyAccessorsWithJvmNames() {
val changes = computeClasspathChanges(File(testDataDir, "KotlinOnly/testFunctionsAndPropertyAccessorsWithJvmNames/src"), tmpDir)
Changes(
lookupSymbols = setOf(
LookupSymbol(name = "changedFunction", scope = "com.example.SomeClass"),
LookupSymbol(name = "changedPropertyAccessor", scope = "com.example.SomeClass"),
LookupSymbol(name = "changedInlineFunction", scope = "com.example"),
LookupSymbol(name = "changedInlinePropertyAccessor", scope = "com.example"),
LookupSymbol(name = SAM_LOOKUP_NAME.asString(), scope = "com.example.SomeClass"),
),
fqNames = setOf(
"com.example",
"com.example.SomeClass"
)
).assertEquals(changes)
}
/** Tests [SupertypesInheritorsImpact]. */
@Test
override fun testImpactComputation_SupertypesInheritors() {